Before you go replacing hardware, though, do the easy things first.
See if you can reproduce the sudden power off. I've had the same thing happen to my computer for no apparent reason. It could be anything, really.
Give the inside of your machine a good cleaning. Dust can cause shorts and it insulates heatsinks, decreasing their effectiveness. Make sure everything is seated properly. Make sure all the fans are spinning.
Then make sure all your drivers are up to date. Sound, video, IDE, mainly.
Do a hard disk integrity check. Scandisk or a third party checker if you've got one.
Run a memory checker to test your RAM.
Run a virus check.