Marge tries to get the kids hair cut, but is stopped when Homer takes them to get haircuts at a new barbershop in the mall. The kids' haircuts are done so badly, that they hide with Homer in a movie theater showing the film Left Below. In response to the kids losing their hair, Marge later makes them wigs using the leftover hair trimmings. Homer now fears that the Rapture will soon be coming. Despite being consoled by Marge and Lisa (who think God would not end the world unless he announced it), and Homer encounters signs suggestive of the Rapture. He uses numerology to calculate the date and time of the Rapture and concludes that it is only a week away.
Homer predicts that stars will fall from the sky, and when there is a blimp accident at the Krusty Celebrity Salute to Specials special and some celebrities fall to their deaths. His prophecy causes many of Springfield's residents to believe that the world will end and they go with him to the Springfield Mesa to wait for the Rapture. However, the hour passes without incident, and the people go home. All of them are annoyed at Homer, particularly Moe, who had sold his tavern to be converted to a Japanese sushi bar. Homer goes home and realizes that he has made an error in his calculation, so he returns to the Mesa with no support. Suddenly, he finds himself naked and ascending into Heaven.
Homer arrives in Heaven, where he is greeted by the tour guide who shows him around. He is then shown to his room where he requests to see his family on the big TV screen in his room. Marge and the children are shown being tormented by the devil. He has a talk with God about saving his family. When God refuses to help, due to Jesus' suffering on Earth, Homer becomes angry. He runs around vandalising Heaven and gets stopped by security. God finally agrees to undo the Rapture by turning back time. Homer later wakes up on the mesa and is reunited with his family, also discovering Moe's Tavern to curiously be back in its normal set up.
When God turns backs time, he exclaims "deus ex machina." This literary device is used ironically because it means "God from the machine" and refers to an inexplicable resolution to an unsolvable problem-—which is what happens in the episode when the Apocalypse is undone.
The scene at the end of the episode, in which Homer and his pals sit drinking at the bar, evokes the Last Supper painting by Leonardo da Vinci, with Homer in the position of Jesus.