The problem has been coined "Facebook intrusion", and is described as having excessive involvement in the service to the point where it affects day-to-day activities and relationships. After studying a group of 672 people -- two-thirds women -- aged between 15 and 75, it was found that the amount of time spent on Facebook directly correlated with a person's depression level. What's important to note here is that this is Facebook-specific; the report goes on to say that spending a lot of time on the Internet in general is not linked to depression.
The biggest harm of Facebook intrusion is that it can replace real-life interactivity. It constantly keeps other people at a distance. "That just doesn't give you real intimacy; it doesn't build your capacity for trust and confidential relationships." Matters are made much worse when someone uses Facebook as a way to avoid real interaction because they're shy. That can turn into something where the person may not even be honest with how they behave online, pushing them even further away from reality.
While it's not covered here, I feel confident in saying that Facebook's side-effects can happen at a much more modest scale, as well. I've found myself in the past visiting the site far too much, and it did ultimately affect my mood. The reasons for that will likely differ from person to person, but it was a bad enough issue for me where I decided to just remove the Facebook link from my toolbar, and then just visit occasionally.
The moral of this story? If you're depressed, social media is probably not going to help.