Because I'm a computer engineer I naturally tend to look at the brain in terms of how computers work. I hope I'm not being disrespectful, but this thing sounds eerily like memory corruption. I mean like corrupted pointers that lead to a garbage addresses. If it's something like that I can well imagine why it's so difficult to deal with - after all you can't 'reinstall' a person's mind. Maybe in the future, if/when we get more precise model's of someone's thoughts, patients could be trained to not go to these corrupted places in their minds? Say, with some sort of neurological videogame that reassociates the paths towards these memories with something bad, and paths that branch off and don't lead to a corruption with something good? I'm most certainly a fish out of the water here, but I like to throw ideas around and keep sort of a childlike naivety about it, if you don't mind.
Like I said in a previous post, it's not a bug, it's a feature. Think of it like a kernel driver that monitors the currently running application. If it detects that the application would overheat the CPU it swaps it out to disk and runs another one that could handle the situation better. Now, this is a very bad analogy, but at least it should give you the sense that it is a coping mechanism, not a flaw. I'd suggest to avoid comparing the brain to a computer. That analogy would hold you back more than help you.
For the record, I'm completely in agreement with "feature, not a bug". For myself and many people I know, mental health stuff makes more sense when looked at like that, and it also matches up with core concepts of Cogitative Behavioural Therapy. At some point your brain needed certain bits of code to survive, but unfortunately the brain can't be cleanly patched once those times have passed (which is also an awful analogy, but works enough for this).