Man! I'm sorry to hear about that.
This sort of thing happens all too often. Just about any heater you can buy is a potential ticking time bomb. There are a few good rules of thumb out there to avoid this kind of thing:
1- Use analog-set heaters as opposed to digital. Yours sounds like it was a digital. I tend to trust analog heaters a lot more because the thermostat is mechanically set and not subject to failures that bad electronic components can experience.
2- Never oversize your heaters. It is better to use two small undersized heaters than it is to use one large heater. Heaters fail, all you can do is mitigate the outcome when that happens.
3- Redundancy. A temperature controller is a great device and will help prevent this sort of thing. The idea is that if one fails (the heater thermostat or the temp controller), the other one will still prevent the tank from over heating.
4- Use open canopies with fans blowing across the water. This is good for many other reasons as well. Evaporative cooling is a powerful thing and might have saved you in this instance. I don't know how practical this sort of thing would have been in your case, depends on the style of tank.
I find it interesting that whenever I read about a heater failure causing a tank crash it has to do with making the tank too hot as opposed to letting it cool too much. I think this is a good indication that people are using too strong of heaters. In my tank during the winter, the heater is on practically all the time. I maintain the temp at about 76. Although this is a bit cool, it is certainly acceptable. The good thing about this is that even if both my temp controller and heater broke and my heater stayed in the on position, I would not be cooking the tank. Now, if the heat in my apartment were to go out, I would probably need to slap another heater in my tank. But, this is a much more manageable and less risky situation than possibly over-heating.