I am no expert, but I had the same problem last week with my shower. It was due to low water pressure. I found out later that there had been a burst in the area. If the water runs too slow the heater could make it scalding hot, so to avoid this there is a cut out on the heating element which shuts off the heater until water flow is back to normal. Water pressure can also drop if you have another appliance running at the same time (washing machine, bath filling, dish washer running).
If your water pressure seems normal, there may be a fault with the cut out.
TomUK
December 2010