In her fascinating book, The Pain Chronicles: Cures, Myths, Mysteries, Prayers, Diaries, Brain Scans, Healing, and the Science of Suffering, Melanie Thernstrom discusses the differences between "integrative" pain and "disintegrative" experiences of pain.
Our friend Dr. Schneiderman discusses Adolescent Cutting. After many years of addressing self-mutilation with youth and some adults, I have become convinced that various sorts of self-harm entail "integrative" pain - a discomfort which helps a person feel more centered, whole, and complete. In fact, it is not unusual for somewhat shakily-constructed people to create or to be drawn to chaos and crises for their strange psychologically-integrating effects.
There might be an entire new theory of masochism in general built on that idea, but I think Freud sort of began to get there first. Perhaps he over-sexualized masochism, or over-death-wished it, but he was on the trail towards an understanding of masochism and its perverse gratifications.