I had a PC doing this last week and the problem was caused by an IDE cable fouling the CPU fan. I'd guess the thermistor on the mobo was detecting an overheat and signalling the OS (XP) to shut down. I have to admit I'm making an assumption about the graceful shutdown, it may have been more abrupt than that.