The fact that you said she should have sex to get rid of depression is not the issue. The fact that you told her how to get rid of it is, when it was based on a personal experience.
I am not going to discuss it, though. I will simply conclude with a word of warning. Be VERY careful what advice you give a depressed person. Even specific medications can be a bad advice. You are not dealing with a bruise or a cut, you're dealing with a psychological sickness, and not one with absolute fixes. Every individual is unique, and sometimes, so is their sickness.
Giving the wrong advice can be the end of someone. See it as a plead from me to you. Phrase yourself better in the future, and don't give personal experiences out as factual solutions. Give them out as they are: Experiences. Pretending to know exactly what you're talking about won't help. Many times, it does quite the opposite.