First night nerves, and these seem to have carried over, and the problem its now locked in your brain and the more you think about it sorry to it will only get worst, I would say the best way out of this is to get your g/f back in the bed room and start all over again, but this time relax and just get in the swing of things, concentraite on her and not you, remember you are there for her.
But before you do this try playing with a condom getting it on and off, but be careful if you are rolling it, it will pull your short and curlie's out.
But just relax and try again, I'm sure it will go better next time.
Good Luck
A lot going on with you,huh? I was once a teenager myself and I know the importance of a boy your age wanting to lose your virginity. It's almost a rite of passage for young adult males like you. I think I may be able to help you out here.
From what I read of your story, I think your problem is more psychological than it is physical. You say that you had no problem getting and maintaining an erection until your girlfriend introduced you to a condom. it may have been at that point that you became concerned. "What if the condom breaks and she gets pregnant..." was probably one of the many subconscious cues your mind sent to your body and it scared you to death, the thought you may accidentally impregnate your girlfriend and saddle her with a responsibility that you and her were not ready to handle.
I don't think masturbating is the problem here. Sometimes it's good to masturbate since it gives you a little practice in what feels good and how to achieve orgasm at your own pace. I think once you get past the trauma of your first experience that things will get better for you.