I am not an expert in this and these are my armchair theories, but they are based on personal experiences and the medical knowledge that I do have. I am only sharing them because I feel that the "experts" do not have enough evidence in their field to make what they say too much more authoritative. Please take it with a grain of salt.

Obsessive thoughts are associated with OCD just as much as with depression. A lot of them happen because of pathways in the brain get strengthened over time so that a trigger will cause a particular thought pattern to occur. The triggers can be many different things, or a combination, from diet related, to amount of sleep, to words you heard and your subconscious brain started thinking about, to concepts you were exposed to. For example almost all of us have obsessive sexual fantasies which get triggered by exposure to porn. We have been conditioned by our society and advertising to have various cravings, etc.

Now, if you want control over these -- it will be a LONG TERM process because your brain gets wired like "hardware", some pathways get stronger over time and you can't re-wire it instantly. (Unless of course you are Phineas Gage, which you don't want.)

There is no 100% solution that works for everyone obviously. Sometimes you can't get from here to there. But if you use the model above, you can almost always make a number of serious changes in what you think about.

Try to identify your triggers by paying attention to specific things that happen before you get the obsessive thoughts. Try to isolate the parts of your mind that are engaged by these things. What commonality do these have? Learning more about your triggers helps you avoid them while you re-condition your brain.

Look at your expectations, which are internal pressures you put on yourself. You set yourself up for disappointment when something doesn't happen, when you find yourself in a certain state where the thing you expected didn't happen. This is a massive trigger, because it is set by yourself, and you self-identify with it. The worst triggers are the ones that you identify with having caused yourself.

Work on breaking bad associations. When I you to complete this two word phrase: "peanut-" do you think "-butter"? If this is negative to you, then try to introduce a competing association that doesn't give you negative triggers, and doesn't cause obsessive thoughts. For example, "peanut-taste". It certainly is a silly example (think of whatever is in your ACTUAL situation, it may not involve just two words but entire thoughts). But the point is, rather than saying "don't think about the pink elephant" and hoping it'll work, you try to associate one or more competing pathways with your triggers, and eventually, through the competition, you may remove the pathway that leads to suicidal thoughts or other obsessive thoughts.

Also you can set up competing pathways that lead OUT of your obsessive thoughts. These may be things you feel strongly about, such as your kids, pleasant associations from your childhood, or things you really want to accomplish in your life. Once you find yourself already thinking about suicidal thoughts, find ways out that worked for you, and write them down. They may lose their power over time, so it is important to find good reasons to believe in them. Notice this matches exactly what you did with the "Get busy living, or get busy dying." You used to say, "Suicidal thoughts? Stop thinking about them or just do it already." And it used to snap you out, but in the long term it just lost its authority just like anything else that fails to deliver on its promise for a long period of time. The best way is to have this combination of

competing pathways that AVOID leading into obsessive / depressing thoughts

and

competing pathways that lead OUT of obsessive / depressing thoughts

work together. Because, if you find that your episodes of having obsessive / depressing thoughts get more and more rare, you will find that you can TRUST the competing pathways to get you out, and unlike "stopping believing" (as you described above), you and your unconscious mind will trust them and follow them, and eventually you will minimize the problem.

Also, people are motivated by contrasts. When you have too much of X, or you get tired / bored of it, you start wanting an alternative to X, or perhaps even "not X". This is what can cause, for example, people who have everything to go and try something completely wacky, that would leave others saying, "what were they thinking?" This is only somewhat related, but if you want to motivate yourself to do something, artificially hold yourself back from the thing you want to do. You will feel the absence and the space and will be glad when given the chance to start doing it.

Finally, HABITS in the real world affects how often triggers come up. The ultimate prevention is by instilling better habits. As one example, some people with chronic joint pain avoid wheat products and find that their chronic joint pain goes away. In general, I would say getting lots of sleep and physical exercise -- especially assuming you are on the computer a lot, since you are here -- will effect positive PHYSICAL changes and can once again be something you can come to trust as a method to have a better life. This trust is important, and if you break your "good habit" out of laziness, your results won't be as pronounced and your trust won't be as strong. You have to let the habit earn its trust. Over time you will be able to take liberties with it, but not in the beginning.

Again these are just my own impressions on the topic, and I fully recognize that it's hard or impossible to do when you are actually EXPERIENCING the obsessive thoughts or depression, so I would recommend to do all your thinking during your "lucid" phase and then work with your "compromised" self -- i.e. the one present during the episodes -- to replace this depression with something better.

I invite any criticism of what I say, like I said I'm just sharing a model that seems to make sense to me.