I bet your power supply is to blame. Over the years, I've had many power supplies fail on me, and when it does, the computer will suddenly shut off during high stress. I bet it happens only when you're running a demanding program, yeah?
Unfortunately, if that's the case, you pretty much just...