Referred pain is an interesting phenomenon where your body is injured or damaged in one location and you feel pain in a completely different location. For example, often when a patient has a damaged diaphragm (muscle located just above your abs) they go to their doctor complaining about shoulder pain.
To understand why this happens you need to look at the anatomy of the nervous system. The nervous system can be divided into somatic and autonomic systems. The somatic nervous system involves the nerves that react to external sensations, like the touch receptors all along our skin. The autonomic nervous system involves nerves that we cannot consciously control, like the nerves that tell our heart to beat.
The diaphragm is a muscle that helps us breathe, and though we CAN consciously control it, it also runs automatically so we don't have to consciously think about taking a breath all the time (good news for all those people who can't multitask...imagine talking on the phone, while surfing the web and watching the t.v. if you had to remember to breath every 5 seconds). The diaphragm is innervated by the phrenic nerve (an autonomic nerve), which comes out of the spine at the same level as the the somatic nerves that innervate the shoulder (nerves C3, C4, and C5 for those who care).
If the diaphragm is injured, the autonomic nerves that warn the brain about this problem start firing. However, on the way to the brain, they get to the spine and mix with the somatic nerves that innervate the shoulder. NORMALLY, somatic nerves warn the brain about pain because somatic nerves are the pain recepters in our skin...where pain will most often happen. Since the brain isn't used to having the autonomic nerves complain about pain, it just assumes that the pain is coming from the somatic nerves. Those somatic nerves are connected to the shoulder, so the brain thinks the shoulder hurts.
Of course...if you just dislocated your shoulder, don't assume your diaphragm is the reason you want to cry.