You could try cleaning out the showerhead if you can get it off or buy a new showerhead if you can't Over time the scale from the heater element gradually blocks the showerhead creating back pressure which increases the water temperature and turns the heater off to prevent scalding. When the water cools down the heater comes on again. Worth a try, cheaper than a new thermostat
Brian
February 2009