Fixing it, did not make it go away. I checked my 21 inch iMac and it has the same thing, but the screen on it does not flicker.
I have two displays connect to the 5K, BenQ and Asus. I disconnected both (they are connected via thunderbolt-to-minidisplay adapter cables), powered down the 5K, disconnected the power cable and after 10 minutes boot it up again. This time, there was no flicker.
So, it seems that it has to do with connecting additional monitors to it, but the question is: Is it a normal behavior when other displays connected to it or not?
Thanks.