I've had a few instances of similar nature. I chalked it up to the batterey/flex cable problem that has annoyed me for a year or so. It affects the trackpad and keyboard but is really sporadic.
If you are experiencing the problem consistently at some point, try putting the MBP on AC, put it to sleep, then take the battery out and see if it goes away.