"Pain gives of its healing power where we least expect it."Feeling pain or feeling down is a natural human response to events, external or psychological, that are, well, painful.
While unpleasant, being in pain can help a process of self-clarification and self-knowledge in terms of knowing what one's limits are, what one should be doing with one's time, what people to cultivate as friends, what activities to focus on, what thoughts to entertain and so on.
Of course clinical depression is pain that is in no way obviously helpful but even such a serious illness as that can also help, in the long run, the goal of knowing oneself, even if only as a reminder of how much one can suffer without giving in to the temptation of suicide.
As Heidegger also wrote
"How can we expect to feel cheerfulness if we were to shun sadness?"Though pain and pleasure are often seen as opposites, pain does lead to pleasure (witness the song by Queen Pain is so Close to Pleasure), as in sexual intercourse where losing one's virginity for women might be painful initially or men their anal virginity, and the capacity for psychological pain in my opinion does signal the possibility for intense joy, at least in a healthy and relatively balanced individual.
Socrates in Plato's dialogue Phaedo makes such a link between pleasure and pain as being two heads of the same beast, where the feeding of one leads to the satiation of the other, for the lifting of pain is in fact pleasurable and pleasure would be of little moment in one's psyche if the latter was unfamiliar with the experience of pain.
Pain is part and parcel of the human condition and as such has a role to fill in the general advancement and evolution of our species. For the couplet of pain and pleasure helps humans navigate their own paths through life's material and metaphysical expressions.