This is as simple as that: if your thread works only with the breakpoints, it does not work at all. The code is simple incorrect. The behavior is a clear indication of the phenomena of
incorrect dependency on the time of execution commonly known as "race condition":
Race condition — Wikipedia, the free encyclopedia.
Now, as you did not create any code sample we could consider here, I cannot analize it and find out where your code design is wrong, or if it has certain bugs. Also, it could so happen that it's too hard to find an exact reason for race condition, but usually there can be some indirect sings of wrong code, some techniques or even style which may formally result in correct code but are impractiable and error-prone.
So, my advice is: learn threading techniques properly and read the article I referenced to understand how race condition gets you into trouble. Your follow-up questions will be welcome.
—SA