Haunted Computer?

My computer started exhibiting some weird behavior a while back. The problem went away but I am curious as to what could have caused it to happen in the first place.
The PC would begin to act erratically from the mouse pointer moving on its own to the system freezing up and shutting down on its own. The most odd of all is that it would turn on by itself in the middle of the night, about 2:00 – 3:00 AM.
What confuses me the most is that when I replaced my mouse the problems instantly went away and have not returned. Is there anyone who knows how a malfunctioning mouse can create these types of problems? BTW the mouse I replaced was a Microsoft Internet Explorer 5 button optical mouse.

Yes, optical mouses can do that.

Do you have a cat? Maybe it pushed the mouse around at night so the computer went on. But if it wasn’t plugged into your wall & it went on, now that would be spooooky.