It's a weird thing, but if you listedn to people who have been in this hobby a long time, they will all tell you that when an aquarium heater "breaks," more often then not what happens is not that it turns off, but rather, it gets permanently stuck in the "on" position. Be thankful you had a hardy fish in there; one less hardy might have died from the rapid heating of the water. And then, as Punkymom pointed out, if you take any aquarium heater out of water immediately after you unplug it, it is almost certain to break.
If you were to upgrade to a 10 gallon tank, that would be sufficient for 4 or 5 zebra danios. They love to swim so the more space they have the better. A betta would be a much better choice for your tank.