This is a blog post by the guy who wrote Proust was a Neuroscientist about the relationship between mood and cognition, specifically the idea that being depressed (not clinically depressed) makes you more analytic and focused. In a way it's like sickle-cell anemia: Being a little depressed makes you focused; being a lot depressed makes you useless.
This might be why bi-polar stays around. (Warning: Just so story ahead.) Maybe it's not an occasional mutation that is immediately selected against. Maybe the mild form of it it has an evolutionary advantage to the species. Maybe the analytic abilities of mild depression and the creative abilities of mild mania attract enough mates to keep them going.
It's an interesting post, and it has links to other related interesting pieces and book recommendations.