I can identify with your situation. I play guitar and sing primarily, and am constantly learning new songs to perform.
Some songs are very easy but others take more practice to learn to play proficiently. Invariably, on the songs that are more difficult to learn, the first time I perform it for a live audience, I experience the same thing you are experiencing.
I am sure it's a psychology issue where other thoughts pop into your brain that override the concentration needed to execute a flawless performance. When you are practicing and learning the piece, you are concentrating exclusively on proper execution. When performing for someone else, you start thinking about the fact that your performance will be judged -
"what will they think of my performance?, am I going to mess it up? what if I forget how the bridge is supposed to go? If I mess up, what will they think of me? Are they really listening?".
Your brain starts processing all of these other thoughts during your performance and gets off track.
I have found three ways to cope with this situation.
1). I try to convince myself before I start to perform for an audience (of one or more) that I can and will concentrate on and focus on - performing the piece the way I know I am capable, and forget there is an audience. In other words, I make a conscious effort to block out the distracting thoughts. The trick is to take your ego out of the equation and try to deliver your best performance of the piece, for the sake of the piece itself. This is not always achievable.
2). Since #1 does not always work, the one thing that DOES work, is experience performing the piece for an audience. I have found that the more difficult pieces are only fully mastered after I have performed it several times in front of an audience. So often I will play it first for a friend (audience of one). Invariably I will mess it up. Usually I will play it a second time for the same friend and most of the time, the second time is 100% better. Then I will play it for a different friend and I find the first time is 50% better than the first time for the first friend and the second time for the second friend is almost flawless. Then I may play it live in a performance situation (with strangers in the audience), perhaps qualifying in advance that this is the first time I have played this song live. Invariably, I mess up at least part of the song but get through it.
It's the confidence gained by getting a little better each time I perform it live that eventually results in the elimination of the distracting thoughts and fear of messing up (which are what cause me to mess up). Eventually I become confident in my ability to perform that song live and I can then play it as good live (every time) as I can by myself in my living room.
So I know that the first time I perform it for an audience, I am going to mess it up. The second time will be a little better. Third time even better and eventually I know I will lose all fear of messing up (although I will never get anything absolutely perfect - but that's just a fact of life in my world). So I try to perform it first in situations that are not as crucial (like for friends or family). For me, that is the best way to master my ability to perform it.
3). If a live audience is not available before I must perform it in a crucial situation, I have occasionally resorted to performing it for a "world wide audience" by making a video to post on YouTube. I have found that the red recording light has a similar effect as a live audience (try it if you don't believe me). By the time I have messed up the first 25 attempts to get it good enough for posting on YouTube, I have become pretty good at performing the song. Just like for a live audience, each performance for the camera tends to get a little better than the previous one. Eventually I will get several that are acceptable candidates (again none will ever be perfect) and I will play back and compare several takes to determine which is the best before posting on YouTube.
If you try the YouTube route, you might want to disable comments until after you have performed in the crucial situation in order to avoid the possibility of a negative comment eroding your confidence.
One thing that I have learned is that - eventually I master live performance of any piece I am capable of playing. And the ones that were the most difficult to master in the beginning, become the ones I most enjoy performing once I have mastered the live performance of them.
Good luck!