Any chance this machine has any sort of warranty left on it?
I'd probably go with heat related but short of taking it apart and making sure that everything is rotating as it should and that none of the vents were blocked, I couldn't even make a suggestion as to the cause or cure.
If there is any warranty left, perhaps the extended AppleCare one, now would be a good time to call Apple.
Did it ever do this before any warranty period ended, if it has?
My iMac is powering off all by itself. It's like some one is pulling the power cord out. Some time it can be on for an hour then turns off while other times only a few minutes. I've tried the SMC reset, bought a new power supply but its still powers off. Put it in the shop but no one knows. Some time it won't turn back on and other times it will.