Mr. Smithers reminds Mr. Burns about Valentine's Day and tries to convince him to let the employees leave early to stay with their loved ones. Mr. Burns refuses, but Smithers convinces him to host a Sweethearts Dance. While enjoying the party with Marge Simpson, Homer Simpson gets a phone call from Grampa Abraham Simpson saying that he's alone and scared that a cat who can smell death is staring at him.
Homer and Marge decide to visit Grampa, spending the rest of Valentine's Day with him. At the Retirement Castle, a nurse gives a pill to the elders, making them hallucinate and start dancing with the ghosts of late loved ones including Mona Simpson. Marge thinks it's not fair to do that to the old folks and decides to do something about it.
Meanwhile at the party, Professor Frink is alone because he's not good in getting a girlfriend. The next day, Homer discovers him sleeping in one of the Nuclear Plant's rooms. Frink confesses that Valentine's Day is hard for people like him. Homer explains that love is a matter of trial and error. Frink gets the idea of determining what women like in a man and using science to become that person. Frink replaces his glasses with invisible blue contact lenses and uses shoe lifts for him to look taller, but even a droid that he programmed to say "yes" still thinks he's not attractive. Homer suggests it could be because of his voice, so Frink decides to use a chip under his tongue to make his voice more attractive.
To test his new self, Frink goes to a yoga class. He manages to impress all the girls in there, but he soon notices that he can't handle his new life and decides to hide inside Moe's Tavern where he realizes that most men there are lonely. He brings all the women to Springfield Planetarium, but instead of telling which woman he has chosen to be his girlfriend, he pairs them up with the lonely men of Springfield and decides to go back to his life as a single scientist.
At the Simpsons' house, Marge discovers that Bart Simpson is taking advantage of the old people's hallucinations to win money on gambling. She takes them back to the Retirement Castle only to discover that the nurse gives powerful drugs to them only to ease her job and Marge manages to convince the nurse to stop medicating them.
The next day, Marge realizes that the elders are extremely depressed. The nurse says that she hid the drugs in the library, but Abraham found the pills and took them so he could start hallucinating and win Mona back. During his hallucination, Marge, Bart and Lisa Simpson convince Abraham to leave the past behind and live in the present, where there's people that still love him.
Frink is later watching the stars with his robot companion that he built, only to get interrupted by her mother as Frink wonders why he built the robot's mother.
In the final scene, Homer and Marge have been experiencing the hallucinations causing them to suspect that the drugs have entered Springfield's water system.