If you've ever been around someone clinically depressed, it becomes painfully obvious how debilitating this condition is on friends, family and career. But, what few people realized until recently, is the incredibly negative physical consequences that depression carries along with it. Depression is definitely not all in someone's head.
NOTE: Read about some of the Not-So-Common Symptoms of Depression.
For example, researchers have long known that there is a connection between testosterone and depression. Men in the lowest 20% of free testosterone, after controlling for other common factors, were found to have three times the rate of depression.  Depression stresses the body - as in a real, tangible stress reaction - and anything that stresses the body can lower testosterone.
Similarly, it is not too surprising to anyone that depression would lead to erectile dysfunction. One would expect to be less sexually stimulated if one was feeling down after all, right? But actually there is a less obvious reason that depression leads so easily to erectile dysfunction: depression is a major contributor to heart disease. One recent study found that the reason for this was simply inactivity.  And that makes sense: if you're depressed, the last thing you feel like doing is going to the gym or out for a jog. What does it matter, right? Other factors in that same study were also that the depressed were less likely to take their medications and also smoked twice as much.
So with depression directly leading to heart disease and undoubtedly lowering of libido and physical activity, no one has been suprised to find that depression leads to erectile dysfunction as well. One excellent study surveyed men before and after a five year period, which allowed the researchers to examine causations. They found that depression can cause erectile dysfunction and erectile dysfunction can cause depression, or is, in their own words, bidirectional. 
Even more astonishing is the fact that a previous study, the Massachusetts Male Aging Study , had discovered that the problem of either moderate or complete erectile dysfunction was nearly 90% versus 25% in the highest to lowest cohort of depressed patients. A 90% rate of ANY condition is scary indeed.
I have to mention that depression is INCREDIBLY hard on the brain. It literally destroys neurons and whack neurotransmitter levels. How does it do this? Around 50 percent of people with significant depression have elevated corisol levels and elevated cortisol levels literally shred the brain.  One study from Washington University School of Medicine that those who had been depresses at ANY time of their life had a 12-15% shrinkage in their hippocampus. Again, depression destroys brain cells and must be dealt with. On top of that, elevated cortisol levels increase the risk of getting diabetes which also accelerates aging throughout the body including the brain. (Some researchers have speculated that low testosterone often plays a role in depressed individuals developing diabetes. ) Because of this, it is absolutely critical to get any and all depression under control as soon as possible.
By the way, an item of interest is the question, "When in life does depression generally lead to erectile dysfunction?" One study looked at this and found that, in general, this bridge occurred in the late 40s and early 50s.  In other words, the freight train of depression will usually result in erectile dysfunction during these two decades of middle age.
A possible solution to this was investigated by one journal that looked at the possibility of giving talafidil (Cialis) to men on antidepressant medications.  The results were good: the men improved their erectile dysfunction and yet were still able to continue taking their antidepressant medication. As you know, I like to see more natural solutions than just popping a pill. But, for the sake of your brain and heart, it is absolutely critical that you defeat any and all depression. In other words, do what you have to do and if medications help, then a combination of antidepressants and talafidil may be a good option for you. It should be added that one study also found, not too surprisingly, that successful treatment of erectile dysfunction using sildenafil (Viagra) led to significant improvement in men who were depressed.  In other words, treatment with antidepressants and erectile dysfunction medications may BOTH contribute to relieving one's depression. Again, something to consider with your doctor.
Because of the heavy consequences to your brain and body, I emphasize getting professional help for your depression. I have also prepared a page that discusses Natural Cures for Depression. Depression can be complex and difficult to completely overcome, but I believe you or someone you care about will find considerable help from this link.
Antidepressants are also a common cause of erectile dysfunction for guys. However, there is one potential solution: Gingko Biloba. See my link on Gingko Biloba and Antidepressants if applicable.
1) JAMA, 2008, 300(20):2379-2388
2) J of Urol, 2007, 177(2):669-673
3) J of Urol, 1997, 15(1):54-61
4) Sex Med, May 2005, 2(3):390-396
5) J of clin Psychopharmacology, 2007, 27(1):62-66
6) Amer J of Psychiatry, Oct 2001, p.1623
7) Saving the Brain, Jeff Victoroff, 2003, p. 85.
8) Endocr Rev, Oct 1, 2005, 26(6): 833 - 876
9) Arch Gen Psychiatry, 2008, 65:283-289