Yeah I'm essentially in the same position as you. I recently got back a chem exam that I thought I did fairly well on....well lets just say that the class average was a 53, and while I did better than class average, it wasnt by all that much...

What's worse is that while normally each student has the opportunity to drop their lowest exam score, I don't get that luxury because I was switched into the class 2 weeks after it started (which is another long, very infuriating story....). So by the time that I switched into the class the teacher already gave the first (take home, review from orgo I) exam, and a quiz. And she wouldn't let me do anything to make it up; she just told me when I came in "well I guess that's the exam you're dropping this semester!"

She also doesn't curve, so we're all pretty screwed.
So I was pretty bummed that morning. What cheered me up though is that later that afternoon I was working in this same professor's research lab (many chem classes at our school are research integrated, so instead of "cookbook labs" we do actual research in our professor's lab), and that day I made a pretty big breakthrough in the research! That got me so excited, and even my hardass professor couldnt help but be a little happy about it

.
So I guess what I'm trying to say (besides venting that long story to people who can relate, which also helps a lot) is that when you screw up, don't beat yourself up over it, remember that you're only human, and try to focus on the positives. You say you bombed this exam, but from the way you're so upset about it I'm going to assume that youve done fairly well on other exams, and you'll get the opportunity to drop this score anyway. So forget about this exam, consider it dropped already if that helps you. Just do everything you can to rock the final.
I go to a small school where you tend to establish pretty close relationships with professors, so I would personally go to the teacher, explain that you thought you were well prepared for the exam, but you clearly weren't, and ask what can be done to improve your performance for the final. Generaly only the teacher knows what is going to be on the exam and how s/he will grade it, so his/her personal input will be invaluable. Also I find intensive review sessions with the professor tends to influence the final if it isnt completely finished yet; there have been times ive been reviewing with a professor and after I struggle through a problem with him/her or ask a question s/he will say "oh that's a GREAT idea for an exam problem!" and then something remarkably familiar will be on the final

.
Also, this is a pretty weird habit of mine, but when I get back a particularly depressing exam score I whip out my syllabus and all my past graded exams/quizzes/assignments/etc, and try to figure out my average in the class so far. Then I try to figure out the minimum score I need to get on the final to get a certain grade in the course. I usually find out that I'm doing much better in a class than I think I am, and it helps to take a lot of the pressure off.