Electric water heater boils?
A new thermostat won't help when the temperature sensor itself is dead or corroded.
What most likely happened is that you turned the thermostat so low that whatever signal was coming from the broken sensor triggered the thermostat to turn on.  But since that signal never changed, the thermostat never "knew" that the setpoint had been reached, so the water continued to heat well past the safety limit.
This is bad for a couple reasons:  there should be a high-temp safety cutoff somewhere (I can't vouch for your particular unit) which, if it exists, is also failing.