Great timing for this topic. My 'best friend' is very mad at me at the moment, although I'm not too sure I deserve it.. She says I've been a very bad friend.

Long rant, warning..
Reason: We were out partying on Wednesday in a bar. I went there with her and her new fiancé (they just got engaged a while ago). She had also invited her ex there who I know well too as we spent almost all weekends together when they were still a couple. There was also another friend and his friends who I don't know.
I ended up talking with some guy who was in our table but I didn't know, he turned out to be very creepy.. He tried to ask me out but someone interrupted him and I 'escaped'. Apparently he was determined to spent the evening in my company and when we went to another bar, he followed. We kinda pretended that my friend's ex was with me (basically he was just sitting next to me and talking to me) so that creepy guy would back off. It didn't work. My friend and her fiancé were then leaving, I borrowed them money for their taxi, and I stayed in the bar.
I had planned to go home with the first train of the morning which leaves at 5 am. The bar closed at 4 am so I would have had to wait an hour outside, it was also raining quite hard. The bar closed and the creepy guy was still there. My friend's ex said that I could go to his place for the night, he probably felt that it would be his fault if something bad happens when he leaves. He still lives in the same place where he lived when he was still with my friend. I was a bit hesitant, but accepted his offer. There is nothing between me and him, and I only slept there and left in the morning. Nothing else.
My friend texted me last night asking how the rest of the evening went and I told her. She said that she kinda assumed I would end up in her ex's place and added a smiley to the message like it was ok. I said that maybe she was still there when her ex said I could go with him and changed the subject. Then she stared to claim that I had been planning it the whole time and was trying to revenge something to her?! We argued a long time with messages and she is now totally pissed off. She knows nothing happened, and she already knew I had been at her ex's place because they had talked about it before she texted me. She says it's ok if I'm friends with her friends (all of them are males) and exs' but this was a bad choice from me and I have offended her deeply.
Was I totally out of line? I can't really see the problem here because nothing happened and she 100% knows it. And her jealousy is a bit much, she is getting married with another guy after all. But apparently I am a bad friend..