The Springfield Isotots make it to a Little League championship game, but when Bart makes an error that costs the team the championship, the townspeople refuse to let him forget it; Homer's attempts to talk his way out of being caught sleeping on a bed in a department store bed end up selling the mattress, so he ends up as a mattress salesman, but he has second thoughts when Reverend Lovejoy trades Homer's mattress for one he just bought
The Simpsons are at a Little League Baseball game, and Bart catches a fly ball, pushing the Springfield Isotots into the championship. The next day while shopping at Costington's, Homer gets tired but can't find a place to sit, so he lies down on a mattress and ends up falling asleep. However, when he wakes up, everybody is staring at him, so he gets up and exclaims his love for the mattress and manages to sell five; he is promptly hired as a mattress salesman.
At the championship, Springfield is against Shelbyville, and is leading 5-2 in the bottom of the ninth with two outs, but Shelbyville has the bases loaded. When their batter hits the ball that could decide the game, it heads towards Bart. He drops an easily caught pop up and repeatedly fails to pick it up, allowing all four runners to score on a walk-off inside the park grand slam, giving Shelbyville the victory.
The entire crowd turns against Bart and throws beer at him, to the point where Chief Wiggum hurries him in to his police car, only to drive back to the stadium and open the car roof so the crowds can continue to throw beer at him after fleeing the stadium. Bart is totally humiliated and is now the town pariah.
At Homer's new job, he assists Apu Nahasapeemapetilon successfully. Then the Lovejoys approach him with a sex problem, so Homer sells them a new mattress made by Matrimonix. The Lovejoys buy it, but return it to the Simpson home next day, their problem unimproved. As Homer is writing them a refund check, the Lovejoys make out on Homer and Marge's mattress, and trade their new mattress for it. That night, when Homer and Marge are unsuccessfully trying to have sex, Homer admits he traded their mattress away. Also that he spent the money they kept in it on a chain for Elvis. The next day, Timothy and Helen Lovejoy are both singing joyfully at the Church.
Bart's humiliation goes on as Bill and Marty tell everyone on the radio. The town continues to angrily mock Bart for losing the game. Lisa, feeling remorseful, tries to cheer him up by taking to see an old baseball star (Joe La Boot) who dropped a fly ball and still grew up to be rich and famous. Unfortunately, it only makes Bart feel worse after the baseball player learns who he is and makes everybody in the building boo him, making him burst into tears.
The next morning Springfield awakes to find a deranged Bart has spray-painted "I HATE BART SIMPSON" on everything in town (including a passed-out Barney). While he is painting the message on the water tower (Marge viewing him using glasses), he lets go of the rope that was holding him up in an attempted suicide to everyone's encouragement.
He survives and is revived by Dr. Hibbert. Marge looks outside and sees an angry mob outside chanting "Bart Sucks" over and over. Finally fed up with all the abuse poured onto Bart, she walks out to them and angrily tells them off for mocking Bart's "boo-boo", telling them they should be ashamed of themselves for treating Bart like this. She also says that it was no big deal for a little boy to lose a game, and she backs up her negative assessment of their harsh treatment of Bart by saying that Springfield is the "Meanest City in America", which is true (there's even a gigantic billboard to prove it). Feeling guilty, the entire town apologizes for insulting him and agrees to restage the game as suggested by Lisa.
After 78 tries (some flying into orbit, some stolen by Homer, one where Moe ran naked on the field), Bart catches the ball, winning the game.
Homer and Marge sneak in to the Lovejoys' home to steal back their mattress, but the Lovejoys return and excitedly rush up to bed, and Reverend solves the problem Solomon-style – he cuts the mattress in half diagonally. Homer convinces Marge to drive behind a billboard where they have sex, just as they did on their honeymoon – complete with the same bum watching them.
Sixty years later, Milhouse nearly lets it slip to Bart that the game was faked to make up for his lack of talent, but then takes it back when Bart starts crying, prompting Bart to say that he rules and Milhouse drools. The episode ends with the ghosts of Homer and Marge watching Bart taunt Milhouse and voicing their disappointment, and Homer attempts to talk Marge in to having ghost sex with him, only for Marge to tell him that it is just not the same as when they were alive, though she still moans apparently (what with being a ghost and all).
Originally, this episode was to air on May 6, 2007. However, on April 16, the Virginia Tech massacre took place, less than two weeks before the airdate of "Stop or My Dog Will Shoot!", which prominently featured gunplay in some scenes. Out of sensitivity to the victims of the shootings, Fox moved this episode up in the schedule.