Lisa's teacher, Miss Hoover, thinks she has come down with Lyme disease and is replaced by substitute teacher Mr. Bergstrom. Because of his unorthodox teaching methods and friendly nature, Lisa starts falling in love with him.
Lisa runs into Mr. Bergstrom at a museum and is embarrassed when Homer displays his ignorance. Sensing that Lisa is missing something in her relationship with her father, Mr. Bergstrom takes Homer aside to suggest he be a more positive role model. After venting to her mother about Homer ruining her 'one chance' to get to know Bergstrom outside of the classroom, Lisa is given permission to invite him to family dinner, only to be shattered when she finds Miss Hoover back and Mr. Bergstrom gone. She rushes to his apartment and finds him having left for another job. She rushes to the train station to catch him, and confesses to that she will be lost without him. To comfort her, he writes her a note and tells her that if she ever feels alone and like she cannot rely on anybody, its contents are all she needs to know. He then boards the train and departs. It reads, "You are Lisa Simpson".
In a subplot, Bart's class prepares to elect a class president. Mrs. Krabappel nominates Martin, while Sherri and Terri nominate Bart. During a debate with Martin, Bart tells jokes and wins the class over. Afterwards, certain of Bart's inevitable victory thanks to his popular campaigning, none of the children in his class—including himself—actually voted, giving Martin the victory with just two votes: one from himself, and the other from Wendell Borton.
Devastated by Mr. Bergstrom's departure, Lisa takes her grief out on the insensitive Homer, calling him a baboon. Marge tells Homer to console Lisa, explaining how her daughter is very hurt emotionally and is in need of her father. Homer enters Lisa's room and finds her crying over her desk. He is uncertain of how to deal with Lisa's sadness, and is uncomfortable seeing his daughter crying. Homer explains to Lisa how he cannot really understand how it feels to lose someone important: everyone he has ever loved and cared about lives with him still. He then alludes to Lisa calling him a baboon, and in a loving manner mimics a monkey, cheering her up. Lisa apologizes to Homer for calling him a baboon, and he accepts the apology. Finding Bart still seething over the election result, Homer cheers him up by reminding him that all the job of class president would have really meant was a lot of extra work with little reward, making Bart feel happy that he lost the election. Finally going by Maggie's room, he places her pacifier in her mouth. Proud that he helped all three of his children, Homer goes to bed with Marge happily that night, stating he is "on the biggest roll" of his life.