Having thoughts is no breach of trust. Why? You can see this for yourself. Close your eyes and just be aware. While you are staying aware without doing anything, thoughts will arise. Thoughts that you did not consciously plan for or ask for. This is because we have subconscious activity in our minds.
Also, trying not to think of a certain thought will have the opposite effect. Try not thinking of monkeys for a minute and you will see.
What is important is, what did you focus on when these thoughts were arising? Did you focus on them and identify with them and go along with them? Or did you let them be as they are and let them pass? If you did the first one, then that is called cheating in some cultures. (And depending on the nature of your relationship, it is highly likely that it will be considered a breach of trust.) If you let them pass, then you didn’t empower them and they will just return to silence. They may arise again at another time, but this time you didn’t empower them. This itself is not a breach of trust unless you did something else on the way, such as lying.
About repairing the trust: You can’t change other people’s opinions about you directly. You can only change yourself. You are not responsible for how they feel inside and how they express themselves. The best you can do is to be true to your own inner knowing, your own heart. And this may or may not result in a romantic relationship with another person.
I would like to refer to the following video about why we have thoughts. I had watched it earlier, and I believe at this time it can give a more comprehensive answer than I can give right now.
Look within yourself and without blaming or shaming yourself, observe. Did you break the trust, or did what happened was a natural process within your mind which you experienced, then remembered and expressed to your girlfriend, and then she decided to break up? It is also important to be accepting for the other person’s self expression. They may not be able to understand or be willing to accept how your mind was working. They may have resistances of their own. If you strive to be unconditionally loving to them and let them be as they are, things will proceed in their natural expression. If you can do this, that person will eventually trust you more, because you held their choice in high regard, regardless of how you personally desired it to be different. Even if we may personally desire otherwise, allowing a person choose by their own free will and respecting this decision is a step forward in creating a trusting relationship. The form of the relationship will be determined by the choices of two people, not one. A person who is genuinely, sincerely, as fully as possible focusing on their inner strength, on the love within will be able to find the ability to accept this form, because ultimately, our happiness comes from within, our fulfillment is created from within, our freedom is innate.