The emotional "pain" of a broken heart is believed to be part of the survival instinct.
A 2011 study showed that the same regions of the brain that become active in response to painful sensory experiences are activated during intense social rejection or social loss in general.