Like they say, what doesn't kill you makes you stronger. Regardless of what happens, you'll come out of this having learned something.
I know exactly what you are talking about because I'm going through a similar thing with one of the solos for our band. It's killing me because I played it 20 times or more in a row over the GuitarTricks backing track in a loop and got where I could nail it pretty concistently. And if I didn't nail it, I was darn close. I also played it over a rhythm loop I created over a drum loop. However, put me on the spot with my bandmates around me and watch me go down in flames... :-).
One thing I did determine was that I was focusing on the wrong thing to keep time. Do you have a drummer playing behind you or it just somebody playing rhythm guitar? If so, I would suggest trying to listen and focus on the dummer...tap your foot to the drummer's beat. By tapping your foot, you hand will want to keep the same rhythm. The other player should be doing the same...and that will keep you all in sync and keep things from being sloppy. The drummer is the pulse that keeps it all together.
It's hard, because you are now dividing your attention between what you are trying to play and what others are playing. The way I'm seeing it is that is one of the skills I'm learning. Tapping your foot helps. I've read where instructors here (Anders) have suggested it. Al DiMeola (a very accomplished virtuoso player) stresses this as well. If you watch him play, he practices what he preaches - his foot is constanly going.