Threesome gone wrong?

I need advice please-

So me and my partner went round to my best friends house she lives with her partner. So we had some drinks (maybe 10 too many) anyway things got a bit weird and we ended up having a thre3s*m (her partner couldn’t get it going) and anyway,the worst happened,she was getting more attention from my partner than I was. I had to physically get his hand so he would touch me and stroke my face just like he was doing to her,and now I can’t get the flashbacks out of my head of him doing it with her basically,I got up and locked myself in the bathroom and just cried for hours,they both stopped as soon as I got up and walked out and all seemed really apologetic but now I feel like everything is ruined including my relationship. I can’t take the sadness anymore and the thought of them both. Has anyone had this happen? Did you get over it? Did you work it out? Shall I just leave him and not see my friends again?