They say a kernel compile is one of the best stress tests you can do. It affects about every core piece of hardware there is.
...What you're describing does sound like CPU overheating, though. Double check all the fans, the heatsink, and make sure the power cables are seated correctly.
If it was a bit more random, I'd be inclined to say that it might have something to do with a failing hard drive. I've seen some odd behavior prior to losing all my data, as well.