Heh- something similar happened to me on my old, crappy computer, and I couldn't figure out at ALL what it was- until I figured out the power button was bad and constantly be just about half pressed down. And every once in a while, something would make it register as being pressed down instead of just being almost pressed down, and the computer was shut off.
Yeah, that was fun to figure out.