It's a bad situation all around: two people who are deeply attracted to each other are hooking up, and the guy can't get it up. He's mortified, she's unsatisfied, and the humiliation will probably make it happen again. Obviously, a great deal of this is mental, and so he has to 'relax' and 'not worry'. Easier said than done, of course. BUT, this doesn't mean there aren't physical things they can do. If he still gets erections but just falls limp at the crucial moment, here's a trick that worked for me when I lost my virginity and recently when I had an attack of the old PA: Let her be on top. It's simpler for him, the angles are less awkward, and she'll probably have an easier time getting it in so there's less of the make-it-o-rbreak-it phase when he's trying to enter her. If she gets tired of this position, just go for a few minutes to raise his confidence (and his cock) and then switch.
This happened the first time, as my girlfriend was very critical of me for many things. So, when we tried to have sex, I immediately lost the erection when I tried to put it in. She was offended, and then I tried to make a joke of it, and she flipped out. Since then, if I really like the girl, I have trouble getting it up. If I don't care about her (which was only once), I don't have a problem.