"The Last Temptation of Homer" is the ninth episode of Season 5.
Homer becomes so attracted to the new employee at the Nuclear Plant that it could endanger his marriage to Marge. He soon discovers that they have so much in common, and he tries to avoid her. However, they are sent to a Nuclear Power Convention in Capital City together.
Bart plays a prank on the teachers by making all the parking space lines too close to each car and therefore not leaving enough space for the teachers to get out of their cars. Afterwards, Mrs. Krabappel blames Bart for what happened and Bart is forced to answer every question for the rest of the year as punishment. Mrs. Krabappel then tells Bart to read the word 'photosynthesis' on the chalkboard but Bart is unable due to sight issues.
Meanwhile, Homer, along with Lenny, Carl, and Charlie, uses a claw to grab a worker's butt; however, the worker is working on something important and a nuclear meltdown occurs when he is grabbed. The nuclear meltdown becomes a potentially fatal disaster when they discover that the emergency exit is actually painted on a wall. After they narrowly escape, Charlie asks Mr. Burns to install a real emergency exit. Mr. Burns chooses to fire him instead and Charlie is deported to an unknown land (possibly Saudi Arabia), where he is forced to dance for the people inside an Arabic Palace.
Dr. Hibbert tells Marge that Bart has a lazy eye and many other disorders which is why he is an underachiever. In the process of addressing Bart's array of maladies, he is turned into a nerd, with orthopedic shoes and thick glasses. Bart then becomes a stereotypical nerd and is picked on by the bullies.
In the meantime, Mr. Burns hired an illegal "alien" named Zutroy to replace Charlie. After Zutroy is arrested by the Department of Labor and deported to his native country, they demand that Mr. Burns make changes in the power plant's policies including hire at least one female worker. Mr. Burns then hires Mindy Simmons, an attractive redhead who Homer quickly develops feelings for. Homer suffers from hallucinations involving Mindy, and obsesses over her hinting that he is falling in love with her. Homer tries to split up with Mindy, using methods such as talking to her (to find out they have nothing in common), writing on his hand, and "think unsexy thoughts," but fails when he finds out she likes donuts, beer, TV, and even makes noises similar to Homer's. It doesn't help when Homer's guardian angel (in the form of someone Homer reveres... Colonel Klink from TV's Hogan's Heroes), whose intention was for Homer to see how miserable he'd have been had he married Mindy instead of Marge, messes up and shows how much better his and Marge's life would have been instead (Homer and Mindy are married and wealthy while Marge becomes President of the United States with record approval).
Meanwhile, Bart is losing his cool and Martin is able to show Bart the hideout where all nerds go to in order to escape bullies. Mr. Burns is now trying to find out which two employees will go to the energy convention in Capital City but all of them are getting along terribly except for Homer and Mindy and to make matters worse they have to go together. Back at home, Marge tells Bart his two weeks of nerdiness are up and Bart goes back to school to tell the bullies, but they still beat him up anyway.
In Capital City, Homer and Mindy share a hotel room. At the convention, Homer and Mindy are crowned King and Queen of Energy and win a prize to Madame Chao's Chinese Restaurant the "sexiest Chinese restaurant in Capital City". There, Homer gets a fortune cookie saying 'you will find happiness with a new love', and Homer fears he will dump Marge and marry Mindy. Back at the hotel Homer and Mindy acknowledge their mutual attraction and kiss. Mindy tells Homer to do what his heart tells him. It is later revealed that Homer invited Marge to the hotel, and they start to have sex. When the teenage hotel worker spies on them and makes suggestive noises, an angry Homer decks the nosy worker hard in the eye.