Usually shutdowns like that are BIOS/Motherboard initiated. Most likely issue would be critical overheating, a bad power supply -- or battery drain if that was being used.
Ram is usually not the case unless you are seeing BSODs to go with it.
If it hasn't happened in Safe Mode, try "clean booting" it. These instructions should apply to Win7 but don't have the OS to check fully >>
CLEAN BOOT TROUBLESHOOTING technique
First, restart in Safe Mode if necessary -- (tap the f8 key promptly on startup and choose the Safe Mode option from the boot menu) or Normal mode
Then:
Run
msconfig and select the "Services" tab.
Check "Hide Microsoft Services" and then disable the rest. Also uncheck "load startup group" on the general page.
Now restart and test the issue at hand
If no problems, run
msconfig and recheck half the disabled items on the Services tab. Test again. If the problem recurs, UNcheck half the items you just checked to narrow down the culprit.
If the problem didn't occur, check the other half, so all the Services are enabled -- proceed to do this on the startup tab as well.
Get the idea? You want to isolate the problem to a specific startup if possible.
Note: if you already have items unchecked under msconfig > startups and are in “selective” startup mode – you should note what these are before beginning. They will need to be de-selected again.
http://support.microsoft.com/kb/929135 << written for Vista but apples equally to XP