I've been in a similar situation.
The lesson I learned for the future was that if someone flirts with you while with someone else and then eventually ends up with you, then the precedent has been set and if/when the cycle repeats then you'll feel like an idiot for not having foreseen it...