make sure the litle metal disk on the backside of your thermostats are TIGHT up against the metal tank so they read the temperature correctly.
My first thought was that you accidently wired an element direct as well, but you stated that you replaced the wiring back the same as original.
If your thermostats are held in place TIGHT against the tank and they are not shuting off, and its wired right, you may have just bought another defective thermostat.
I have had this happen more than once.
They are pretty fragile, and theres not much inside them..just a small disk of metal that concaves at a given temperature that throws a little plastic switch…I have bought BRAND NEW thermostats that were faulty on more than one ocassion.