Hmm... you know how surge protector plugs work? Basically when they notice a surge (when lightning strikes, or the transformer) they notice it, and turn off the power before it can cause damage to components connected to the system which is whats happening, as these surges can be very dangerous.
As for stopping it shutting them off, there is something called UPS, which is a battery that stores power, and when it goes from the power supply, it starts drawing power from the special battery.
I dont know where you can buy them i'm afraid, but I'd think they were connected to the PSU (power supply) in some way and so might need a special one.
It would give you time though to turn off your PC, before the power on that goes (should give you a bit of time)
To test if yours already supports it, but its not switched on, go to the Control Panel, and to Power Options. Go to the UPS tab. Are options blanked out or clickable? If they are clickable, you might just have one already on the system ready for use!
I hope this helps