Principal Skinner walks into school and discovers that the class gerbil, "Superdude", has died. As Groundskeeper Willie digs a grave, he unexpectedly strikes oil. Skinner and Superintendent Chalmers lavishly think of ways to spend the school's newfound wealth, taking many student requests, including Lisa's suggestion of hiring Tito Puente as a music teacher.
At the Springfield Nuclear Power Plant, Homer is disturbed that Mr. Burns can never remember his name, even after working for him for ten years. He takes a suggestion from Marge's and sends Mr. Burns a box of chocolates with a family picture underneath the candy; however, Burns and Smithers are not interested in the one candy covering Homer's face and discard the box. As a result, Burns writes a "thank you" card only to Marge, Bart, Lisa and Maggie, further angering Homer.
Meanwhile, Mr. Burns learns of the school's oil and immediately decides that he must have it, even as Smithers voices his disapproval. After failing to convince Skinner to give him the oil through a poor deception, Mr. Burns establishes a slant drilling operation and beats the school to be the first to tap the oil well. The school is told they have no legal recourse, and Willie and Puente are laid off to cover the school's losses.
Mr. Burns' drilling operation causes further harm and distress to many Springfield citizens: Moe's Tavern is closed due to the harmful fumes from the drilling, leaving Moe and Barney enraged; the drilling wrecks the Springfield Retirement Castle, leaving Grampa homeless, forcing him to move in with the Simpsons; and Bart's treehouse is destroyed by a burst of oil from the rig, which also injures Santa's Little Helper.
Mr. Burns then reveals to Smithers his grandest scheme: the construction of a giant, movable disc that will permanently block out the sun in Springfield, forcing the residents to continuously use the electricity from his power plant. A horrified Smithers finally stands up to Mr. Burns, insisting that he has gone too far; Burns fires him in response.
Later, Homer sneaks into Mr. Burns' office and spray-paints "I am Homer Simpson" on the wall in giant letters. Mr. Burns catches him in the act, but yet still seemingly does not recognize Homer. In a rage, Homer attacks him and is hauled away by security. All the citizens affected due to Mr. Burns' mad schemes, including Homer and even Smithers, swear revenge.
A town meeting is held to discuss Mr. Burns' actions. Mr. Burns arrives, armed with a gun after his encounter with Homer. Despite the whole town standing up to him, he activates the sun-blocking device, thinking himself invincible. He walks into an alley, obscured from view, and says: "Oh it's you, what are you so happy about? ... I see. I think you'd better drop it." He struggles with someone until a gunshot is heard. He stumbles out into the open, wounded, and collapses on the town's sundial. The townspeople find his body and Marge tells all of them that since Burns has angered so many people recently, just about anyone could have been the shooter.
As Mr. Burns fights for life at the hospital, the Springfield police are working to find his assailant. Smithers wakes up the next morning and vaguely remembers shooting someone the night before in a drunken rage. Guilt-ridden, Smithers heads for a local church, and is promptly arrested when the confessional turns out to be a police sting. While passing the media in his way to the police station, Smithers makes a witty remark that Sideshow Mel recognizes from an episode of Pardon My Zinger that aired at the same time as the shooting. Mel realizes that Smithers must have watched it as well, giving him an alibi. As Smithers' memory clears, it turns out that he had actually shot Jasper in his wooden leg.
With one of the prime suspects cleared, the police, aided by Lisa, eliminate other suspects, including Tito Puente (whose revenge took the form of a "slanderous mambo"), Skinner (who was busy applying what he thought was camouflage make-up at the time of the shooting), Willie (who cannot fire a pistol due to arthritis in his index fingers), and Moe (who is cleared via polygraph test). After a surreal dream about Lisa, Wiggum finds an eyelash on Mr. Burns' suit which matches Simpson DNA. At the same time, Mr. Burns wakes up from his coma and cries, "Homer Simpson!"
The police raid the Simpson home and find a gun under the seat of their car, covered with Homer's fingerprints and loaded with bullets that match the one fired into Mr. Burns. Homer is arrested for attempted murder, but escapes from the paddywagon when it overturns while the police are trying to pick up a Drive-Thru meal. Smithers offers a reward for his capture.
At the hospital, it is revealed that "Homer Simpson" is the only thing that Mr. Burns can say, suggesting that his supposed "accusation" may not have actually been one. Hoping to clear Homer's name, Lisa returns to the scene of the crime to investigate and figures out the identity of Mr. Burns' true assailant. At the same time, Homer arrives at the hospital to confront Mr. Burns and demand that Burns exonerate him, despite being somewhat impressed that Burns finally remembered his name. After a police bulletin reports Homer's location, the police, Lisa and many other citizens of Springfield all race to the hospital. Upon entering Mr. Burns' room, everyone finds an enraged Homer vigorously shaking Burns and demanding that he take back his accusation. Homer's shaking him returns Mr. Burns's ability to speak normally, and he quickly asks who the person shaking him is. Apoplectic with fury at Burns again not remembering who he is, Homer grabs Wiggum's gun and aims it at Mr. Burns' face, demanding that Burns recant his accusations. Mr. Burns then laughs at the idea and confirms that Homer did not shoot him. He then reveals the true assailant: Maggie Simpson.
Mr. Burns reveals that, after leaving the town meeting, he came across Maggie eating a lollipop in the Simpsons' car. Mr. Burns decided to try stealing candy from a baby, but Maggie would not let go of the lollipop, resulting in a struggle. As he finally yanked it away, his gun slipped from its holster into Maggie's hands and fired at Burns. The gun and lollipop both then fell beneath the car seat; Homer would later unknowingly leave fingerprints on the gun while feeling around under the seat for an ice cream cone he accidentally dropped. Lisa guesses that with his last strength, Burns must have pointed at the "S" and "W" on the sundial (with the "W" appearing as an "M" from his perspective), to identify his assailant; Mr. Burns corrects that he was actually swallowing his gold fillings to protect them from being pilfered by the paramedics. The "S" and "M" were purely coincidental.
Mr. Burns demands for Maggie to be arrested for the crime, but he is dismissed by Chief Wiggum, who says that no jury would convict a baby for a crime, except "maybe Texas". Marge also adds that the shooting must have been an accident, considering the fact that Maggie does not know how to operate a gun. The final shot shows Maggie with shifty eyes suggesting it may not have been an accident after all.