Yeah, I came pretty close (I think) to deciding to kill myself back in 1996. After that I went a long time with few - or no - suicidal thoughts, but every once in a while over the past couple of years I found a few of those thoughts creeping in again. I
doubt I'll ever actually go through with it, but who can predict these things.
Probably the biggest thing(s) I've learned that help:
1. Fish-oil is considered to have an anti-depressant effect. And of all the "folk remedies" you sometimes hear about, this one has a fair amount of legitimate scientific research backing it up. I've been really depressed before, took a couple of fish-oil capsules and felt more cheerful within an hour or two.
2. Exercise does help for me. Just being "in the zone" working hard in and of itself helps, as does the "runner's high" effect. Plus it's a chance to plug my headphones in, put on some heavy metal and tune the rest of the world out and just jam. Trail running is fun and it's great exercise. I highly recommend it, along with mountain biking. But pick your own favorite.
3. Pay attention to the dialogue that's going on in your head. When you find yourself thinking "bad" thoughts, ask yourself "Wait, why am I thinking this? This is stupid, I don't want to think this crap, I'm going to think happy thoughts now." It sounds weird, but this kind of "meta" thinking does work (well, for me anyway). I was inspired by some stuff on CBT (Cognitive Behavioral Therapy), so you may find reading up on that to be useful.
There are a zillion books on dealing with this kind of stuff in the self-help section at Barnes & Noble or Borders. I have a couple, but I basically bought them, set them aside, and never read them. But you might find it useful to go in one day, browse that section, take a couple of books and go sit in the cafe and skim / read a little...you may find something useful.
4. Studying Zen Buddhism has also been helpful to me. I don't consider myself a Buddhist per-se, but I think their way of thinking to be useful. I'm still trying to adapt to it, but just reading Zen literature usually makes me feel better.
5. Eliminate negative influences as much as you can. If you have "toxic" people in your life (wife, girlfriend, friend, co-worker, boss, whatever) find some way to get away from them. The last thing you need is negative people dragging you down, or influencing you in a negative way.
And while I've never done it myself, a support group of some sort might be useful. Even if it's online and not in meatspace. If you believe - as BobbyH says below - that suicidal thoughts are a symptom of depression, you might find the /r/depression sub-reddit to be useful. I browse it every once in a while and some good stuff gets posted sometimes.
And if all else fails, my default advice is "get drunk and listen to Motley Crue." \m/
Edit: also, if you ever just want to talk, feel free to email me. My email is in my profile.
Links:
http://www.webmd.com/depression/features/fish-oil-to-treat-d...
http://abcnews.go.com/WNT/Health/story?id=129498&page=1
http://www.mayoclinic.com/health/fish-oil-supplements/AN0139...
http://www.reddit.com/r/depression