When is it okay to end a sentence in a preposition?
So we've all heard the admonishments from our teachers not to end a clause with a preposition
A plumber visits a wealthy estate to fix a clogged toilet. As the butler opens the door, the plumber barks out,"I'm here to fix the toilet. Where's your bathroom at?"
"Please try to speak with more discretion. We do not want to disturb our neighbors with the details of our plumbing issues. And we most certainly do not end our sentences with prepositions, sir.
So the plumber lowers his tone and says more cordially, "I'm here to fix the toilet. Where's your bathroom at, asshole."
Anyway, back to the matter at hand. I have come under the impression that this is a rule of thumb to help the elementary student avoid mismatching case for the target of the preposition rather than a hard rule. For example by placing the preposition closer to its target, you avoid constructs like: "Who did you give the invitation to?" instead of the proper "To whom did you give the invitation?". Moving the preposition closer makes the incorrect case sound absurd. No one would ever say "To who did you give the invitation?"
All of this introductory text leads up to this simple question: Is this phrase correct "Whom did you give the invitation to?" or is it still incorrect english even though we addressed the issue of case?