IMHO, I think you have already ruined your relationship with you GF. As other posters have noted, there is a high probability that your GF will find out about your indiscretion, and I don't think T.O. Tourist's advice will really work (sure you can deny or say it wasn't you, but do you honestly think any reasonable woman will actually fall for this BS?)
Many woman will want to believe that their friends are jealous of them.
I can think of only 2 solutions, neither of which is pleasant:
(1) Own up to your mistake and tell your GF the truth. Likely she will feel angry, betrayed and hurt, and will probably end your relationship with you, but at least you can clear your conscience.
It wasn't me.
or
(2) You can pre-emptively end your relationship with your GF, telling her that you are simply not the right guy for her and that she deserves better.
I have no idea what happened.
Either way, it's important you own up to your own failings -- no one forced you to have sex with your GF's friend, and these things don't just "happen". You chose to do this, and you have to face that choice like an adult.
Deny everything!
Again, just my humble opinion; take it for what it's worth.