Hi,
Bad sectors on a Hard Drive won't cause it to do that, well not that i wouyld of thought anyway.
Has to be software related, can you try a different keyboard??? Or a an adaptor onto the one you have and use it in a PS2 port?
Still trying to think as i had a similar problem on my step dads PC, but my brother sorted it in the end.
Could also try updating the driver for the SMBus, but you will have to get that from the Manufacterers site.
You seem pretty computer literate so the only other thing i can think of is to get on another computer and copy the drivers for keyboard and mouse and stick them onto yours.
Edit: You did install all of the drivers for the motherboard when you reinstalled XP didn't you?