|MadSci Network: Neuroscience|
When you whack your thumb with a hammer, the soft tissue (like fat and connective tissue under your skin) gets damaged. This is why you sometimes see a bruise (which is caused when blood leaks out from broken blood vessels). When the tissue is damaged, various chemicals are released by the damaged tissues and by nerve terminals in the area. These chemicals cause the sensation of pain. Pain is good, because it tells you not to do that again. And, it causes you not to use the thumb for a little bit until it is healed, or at least feeling better in a few minutes. These chemicals that are released include potassium, which is released by cells when they are injured, adenosine, 5-hydroxytrypatimine, increased acidity and peptides (essentially short proteins), like bradykinin. These chemical cause the sensation of pain you feel. The feeling of pain decreases as your damaged cells stop releasing them and they break down or are washed out of the area by your blood. We're supposed to recommend sites or references about the subject. Unforunately, I haven't been able to find any good ones. The only thing that I found was the book Pain, by Malzack and Wall published in 1990 by Columbia University Press. Thanks for you excellent question.
Try the links in the MadSci Library for more information on Neuroscience.