Unplanned repeated key presses Repeated key presses are being registered by the Macbook Pro (running OSX 10.6.8) that I'm using.  

For example, if this had happened in the above sentence, on pressing 'k' it would keep pressing 'k' several times unless I type some other key and looked like this: kkkkkkkkkkkkkkey.  

This does not happen all the time but is very annoying. Have seen this happen in 2 text editors that I use: Komodo IDE, vi. And, also once while composing a message in Gmail. So I guess this is a problem with the Mac internals and not that of a particular application.   

How can I avoid that?
Like you said, it doesn't look like a software problem, since it's happening randomly on multiple applications.

So it looks like an hardware problem. Your best solution is to go to an Apple Store to get it looked at.