I would duck, if I were you, you have some 2x4's coming your way... you'll soon learn what those are.
Jake, happy people do not have affairs. Happy people do not have affairs even if their best friends are having affairs. Just doesn't happen. Unhappy people have affairs. So, those seemingly "small issues" that you cannot believe led to the marital issues, you better stand up and pay attention FAST. I fear that this casual attitude regarding her issues is showing in your attitude during your conversations with your W. That's very hurtful to people and it leads to a feeling of hopelessness on the part of our spouses. I would seriously reconsider your position regarding these issues and focus a bit more.
As far as getting these thoughts out of your head... you just HAVE to. Start figuring out what to replace those thoughts by in your mind when they come up. Meditate. Do anything you can. But understand, you push this issue? YOU WILL LOSE. Every single time. No doubt about it. With virtual certainty. Sorry for the directness, but its experience talking here.
I know it is painful and I am so sorry for what you are going through but it's time to shift gears.