It took time and effort, but you replaced the smoking
thought with a non-smoking
thought, with positive thoughts.
And then, for argument's sake, let's just say that if, a decade after that, that you're at a party, and an old friend offers you a cigarette. You think, why not?? and you smoke it.
Now - does that mean that you're back to square one, hooked all over again? Of course not. The positive habits you've built up in the meantime are what count.