Last month I finally fixed the unresponsive Keyboard and Trackpad issue I was having with my MacBook Pro. I was having this problem for a few months already, in January I ended up having to have my keyboard replaced because of a very odd issue that was unrelated to this issue. Hoping maybe to have fixed it, it did not.
Now I originally thought that this was due to an OS X update that came out, I believe 10.5.4. But it was definitely not an issue with any OS X upgrade and is a hardware issue. Apple is aware of this issue too and it is not an issue that comes with all MacBook Pro’s. It should not be with new models either as of 2009, mine is a 2008 model.
The problem with this issue is that you need your top case replaced, the problem lies underneath the trackpad and deals with the ribbon. There is no other way to fix this issue. You may be able to temporary fix it with tape but trust me, just take in the laptop to get it fixed. If you are not under warranty, I still recommend it but you can also buy a new top case yourself to and do it yourself but you might as well just have Apple do it unless you know what you are doing.
How can you prevent the issue from coming back? Well you can not, unless Apple themselves have fixed the issue but probably doubtful. It should not come back but I will suggest taking extra care of your MacBook Pro and trackpad especially. Do not apply too much pressure. If you want to be even more cautious, use a mouse if possible.