I had the same issue with my iMac 27" late 2012 model, random shut down, pull the power cord, wait, plug back in, runs fine or a while, repeat every few days until it became daily. I replaced the power supply board and it's all good... Only a few days so far with no problems for a REAL proof, but it was shutting down daily. Key things? I think the fact that I had to unplug after every shut down to be able to restart was a solid clue that it wasn't a software issue. As Greg Blair pointed out, I ALSO have UNGROUNDED power to my machine. Maybe that is what kills the board? Just mentioning it here in case that turns out to be a common clue as well.