Without knowing more facts about the situation (like why you shouldn't have passed), I would say "inappropriate."
If you just think you did badly, but you managed to pass by yourself, then it's not appropriate to thank a professor for a grade you earned.
I also think you have nothing to gain by thanking her. I would just take the grade and move on.
And, if the professor actually did something inappropriate herself (which could be implied form your post), then there's no reason to rub it in the prof's face. If you really want to express thanks, I would go talk to the prof in person and ask her how to improve on the exam, express disappointment in your own performance, and thank her for being generous (I guess).
You've got me curious, though. If you care to explain... did she actually tell you that you shouldn't have passed, or do you just think you did not deserve to pass?