Research in the U.S. and other countries suggests that depression should not be thought of as a disorder but as a mental adaptation that brings certain cognitive advantages.
Depressed people often think intensely about their problems. These thoughts are called ruminations; they are persistent and depressed people have difficulty thinking about anything else. Numerous studies have also shown that this thinking style is often highly analytical. They dwell on a complex problem, breaking it down into smaller components, which are considered one at a time...Read more at Scientific American
This analytical style of thought, of course, can be very productive. Each component is not as difficult, so the problem becomes more tractable. Indeed, when you are faced with a difficult problem, such as a math problem, feeling depressed is often a useful response that may help you analyze and solve it. For instance, in some of our research, we have found evidence that people who get more depressed while they are working on complex problems in an intelligence test tend to score higher on the test.