Yeah - pretty much everyone makes mistakes now and then, but if you're making the same mistake over and over again it can get annoying.
I'd do like falling said, and if you've conquered the mistake but still mess up when you're playing it all the way through, I'd start trying to fix that by playing from the line before a bunch of times, and then from even further back and then finally try it all the way through and see whether you've fixed it once and for all.
Also, if you can try and relax and not worried when you're getting up to that bit, you will do better. Don't think, "Oh, no! Here's the tough part! I'm going to mess up!" I know I always mess up when I think that.
To avoid making these mistakes in future when learning a new piece, I'd just make sure I had consistent fingering, make sure I practice all the hardest bits first and a lot, and never play fast hands together too early.
For fixing the moonlight mistake - can you play the part where you have a glitch completely in time when you play separate hands? If you can then all you can do really is play it a lot really slowly until the mistake goes away.