"Can anyone please tell me how I should have handled this situation,"
Well, IMHO, 'should have's doesnt matter. What is done is done.All that matters is its over and looks like u dont feel like going to that person again.
So chill, n remind urself of this incident next time you feel drawn to some one. If you feel that u r gonna regret it n run away aftr the 'deed', u know wht to do or rather what not to do...

Somebody told me, "You are what you eat".Now I know why I'm nuts!!