Overall, based on my limited research it appears there is no evidence that people who are more logical are more likely to experience depression. There is a theory that people who see the world more accurately (of which rationality would be a component) are more likely to become depressed. It is called depressive realism {1}. However, the theory doesn't seem to be well researched or supported.
Rather that high levels of logical thinking supporting depression it may well be that factors that predict logical thinking also predict depression. One of these is introversion which, based on some research {e.g., 2}, may be correlated with intelligence (which is related to logical thought) and appears to be correlated with depression {3}.
Also, and this is just my opinion, I think that it is possible that the relationship that between maths, physics and programming students and depression might actually be explained by link between introversion and depression as all of these types of careers are probably more commonly associated with introverts.
References
{1} Ackermann, R. and R. J. DeRubeis (1991). "Is depressive realism real?" Clinical psychology review 11(5): 565-584.
{2} Furnham, A., et al. (1998). "Personality and intelligence." Personality and Individual Differences 24(2): 187-192.
{3} Janowsky, D. S., et al. (2002). "Myers Briggs Type indicator personality profiles in unipolar depressed patients." The World Journal of Biological Psychiatry 3(4): 207-215.