Have you tried unplugging all the usb devices and then plugging just the keyboard or mouse into different usb ports?
I said I'd report back and I've found that, if I unplug my keyboard, the machine shuts down... Hmm. :¬/ And I don't think I nudge any cables.
This was quite recent and on plugging the MP3 in again it wasn't recognised prompting me to see if unplugging a usb device might help.
Bev.