I know it sounds like a classic #slatepitch, but this article in the Atlantic is pretty fascinating.
Drs. Miller and Raison believe that acute (or severe but short-term) stress can not only lead to depression, but also jump-start the immune system. The physicians note that in the environments in which our ancestors lived, acute stress was often associated with the threat of physical harm or physical wounds. And unlike today, wounds readily led to infection and death. Therefore, Drs. Miller and Raison believe that evolution favored individuals whose immune systems operated under a "smoke-detector principle."
Although smoke detectors often react to false alarms (for me, burnt toast), if you removed the detector's battery and a real fire occurred, the consequences could be severe. Similarly, immune responses to acute stress are typically not necessary -- not every stressful situation results in a wound and infection. However, if our ancestors became wounded even a single time and didn't experience a piqued immune response, they might die from an infection.
It turns out that depression may not be a mere trade-off for a vigorous immune response. Dr. Miller suggests that depressive symptoms like social withdrawal, lack of energy, and a loss of interest in once enjoyable activities were actually advantageous to our ancestors. For example, a loss of energy might ensure that the body can leverage all of its energy to fight an infection. Also, social withdrawal minimizes the likelihood of being exposed to additional infectious agents. In this way, Drs. Miller and Raison note that "depressive symptoms are inextricably intertwined with -- and generated by -- physiological responses to infection that, on average, have been selected as a result of reducing infectious mortality across mammalian evolution.