It doesn't erase all those past times of being impotent. It just takes care of the mechanics of having sex. A medication such as Prozac will give someone who is feeling depressed more energy, brighten their mood, and perhaps relieve some of the pressure off of the suicidal ideation. But it will not make a person forget their depressive feelings, or resolve the situation which has often led them into the depressive episode to begin with. If you had poor coping skills or poor relationship skills before taking the Prozac, you are still going to have poor skills after.
People expect too much from medications alone.
Medications work best when a part of a larger, comprehensive treatment approach to these complex problems. Our knowledge about mental disorders has not progressed to the point where we have determined that one factor causes these problems. It almost nearly never does. So just as the causes of the problems are complex and multi-factored, so should the treatment be.