According to a study carried out for 10 years by the Columbia University, individuals who are religious are less likely to suffer from clinical depression.
They gathered a group of 114 adults, whose parents were both, depressive and non depressive (probably to rule out the "genetic predisposition") and what turned out was that those who claimed religion and spirituality as "highly important" had about one-tenth the risk of experiencing major depression compared with those who did not.
So according to this longitudinal research, spirituality or religion appears to have a protective effect against primarily the recurrence of depression. In some, it may also protect against the onset of depression. This effect was strongest in those whose one or more parents also suffered from depression.
My take on this one is that appareantly religion gives them a sort of "placebo" effect. Let's not forget that many religious groups prey on "depressed" individuals for their own gratification. The easiest people to seduce into a religious doctrine are the ones who are searching for a "why me?".
Most religions try to make you feel "special", they also have support groups where you can talk with others about your misfortunes, or they have a priest/pastor who will address your concerns in a personal matter.
Is actually the human to human interactions what makes us happier. Let's not forget that we are social creatures. Whenever we share with others and they supply us with empathy plus an ego boost we feel top of the world.
Religion will give us a divine cause and effect for everything, with the premise that everything is for our "own good" and since God loves us we will get some eternal reward also.
When you are indoctrinated is like wearing some pink colour glasses. Your life gains some imaginary meaning. You delude yourself with the help of your brothers and sisters. If you try to look objectively at the "divine answer" of your suffering you will realize that is the ultimate nonsense.
What helps religious people with depression is the fact that they believe there is someone who cares, whether is their imaginary deity, the priest, or their brothers and sisters in the congregation.