After stumbling across Principal Skinner and Mrs. Krabappel kissing, Bart strikes a deal with them to keep it a secret, but unknown to Bart, the deal he makes lands him in the middle of this love affair.
Martin invites his classmates to his birthday party, but the gathering turns out to be incredibly boring. To cap off the poorly received party, the celebration gets abandoned when everyone becomes ill with food poisoning that was caused by serving diseased oysters instead of cake. In the meantime, Principal Seymour Skinner and Edna Krabappel attend and have a conversation which leads to them discovering that they have romantic feelings for each other. They end up kissing in Martin's pink playhouse in an act witnessed by Bart (one of the few to escape the poisoning, Lisa did too, but feigned sickness so that she could leave with an excuse).
Bart plans to reveal what he witnessed, but Seymour and Edna fear that they would be fired if anyone found out and they swear him to secrecy. They hire him as their gofer, so they can secretly exchange messages. Bart agrees for a while, because the reward for his cooperation is that Milhouse Van Houten will inherit Bart's poor school record. Eventually, Bart grows frustrated about his home, school and social life continually being interrupted to help them advance their relationship, putting him in embarrassing situations. One afternoon at school, after he is embarrassed in front of his classmates by having to say one of Seymour's messages to Edna out loud, Bart becomes so furious after getting ridiculed by his friends and he bitterly responds by gathering the entire school in front of the janitor's closet and opens the door to reveal that Seymour and Edna are kissing each other.
Word quickly spreads throughout Springfield, with the story growing more illicit and exaggerated with each passing turn. An appalled Chief Wiggum, upon hearing his son Ralph's version of the events, alerts Superintendent Gary Chalmers. Chalmers tells Seymour that the whole town's an uproar about his sleazy shenanigans and gives Seymour a choice– to either end the relationship or have the both of them face dismissal so fast that his mortarboards will spin. Seymour chooses that love is stronger than his professional goals, so Chalmers fires him and Edna, expecting them to leave the building by 3:00.
Bart learns that the couple have lost their jobs and shows remorse for them. After Seymour apologizes to Bart for humiliating him, Bart encourages the former principal to stand up for himself. Seymour and Edna lock down the school, call the media and make their demands: They want their jobs back and the townspeople to not interfere with their relationship. However, several residents (specifically Maude Flanders) rebuke with the accusation about the two having sexual intercourse in the janitor's closet. Seymour insists nothing of the sort happened and that he is a virgin. Everyone accepts the explanation, since no one would ever give false information about being a 44 year old virgin. Chalmers agrees to reinstate Seymour and Edna as though nothing ever happened. The couple choose to continue their relationship more privately than ever by convincing Bart that they have broken up after thanking him for helping them. However, in the last scene of the episode, they have sex in the janitor's closet.