Michael apologizes to Oscar, after he finds out he's gay, for calling him a homosexual slur–but his apology outs Oscar to the entire office. And Jim decides to take a promotion at the Stamford office.
Micheal and Dwight go to a convention in Philadelphia and run into Jim, and Michael becomes jealous of Jim's relationship with his new boss. Meanwhile, Pam gets ready for her first date since her engagement.
Michael is in trouble once again as Jan busts him for declaring it's “Movie Monday” where everyone watches a movie and neglects work. Angela pushes Dwight to make a move on Michael's job while Pam and Jim find creative ways to waste time.
Michael takes on the role of office grief counselor when he learns that his old boss has died.
Dwight takes former temp Ryan to his beet farm to initiate Ryan to his new job at Dunder Mifflin.
Michael encourages the entire Scranton branch to support Kelly and attend a local celebration of Diwali, the Hindu Festival of Lights. Meanwhile, Andy convinces Jim to turn a late night of work into a drinking game.
When Jan tells Michael that the Scranton Branch will be shutting down, Michael strives to keep his staff's spirits up. Meanwhile, everyone privately begins to envision how their lives will change in the aftermath.
Jan informs Michael that the Scanton branch of Dunder Mifflin will be merging with the Stamford Branch. Jim and Pam are reunited while the other employees of both branches must adjust to their new co-workers.
Michael learns that one of the new employees at Dunder Mifflin Scranton has a criminal record. Meanwhile, Jim helps Andy make a move on Pam.
Trouble among the members of the party planning committee results with the office having two competing Christmas parties, but Michael isn't interested in celebrating because he has just broken up with his girlfriend.
Michael isn't supposed to let anyone know that he and Jan went on vacation together in Jamaica, but he accidentally circulates a compromising photo of them to the office via e-mail.
Dwight does a favor for Angela to keep her from getting in trouble. Andy finds out and uses it against him to get in tighter with Michael. Now Dwight must fess up, which will reveal his relationship with Angela, or risk getting fired.
Michael returns from Jamaica, and accidentally lets slip that he went with Jan. When he tries to send a revealing picture of Jan to Todd Packer, he inadvertently sends it to the packaging department, and soon the picture is spread throughout the entire company. Jim and Karen have an argument over Karen moving into an apartment close to where Jim lives, until Pam mediates a solution between them. Although she appears happy to have helped, she is later seen crying. Jan later appears at the office and tells Michael that she wants a relationship. She has yet to find out about the picture.
Dwight arrives late for an early morning meeting, where Michael announces that the members of the sales staff are teaming up for sales calls in an Amazing Race-esque challenge. Andy spends the day trying to convince Michael that Dwight is untrustworthy. Meanwhile, Kevin announces to Angela that their sales reports weren't mailed to New York, but Angela assures him that the problem was handled. When the teams return, Andy discovers that Dwight's morning tardiness was due to delivering the reports to New York for Angela. Dwight, instead of revealing their relationship, resigns his position.
Andy does the impossible–he makes everyone in the office miss Dwight, who is forced to take a job at Staples. Meanwhile, Oscar comes back to the office and Michael predictably throws a stereotypical Mexican party to celebrate.
Michael asks Jim to get a male stripper for Phyllis's office bachelorette party, but he gets a Ben Franklin impersonator instead. Meanwhile, the men's bachelor party goes as planned until Michael becomes uncomfortable with the stripper.
Oscar's return from his vacation prompts Michael to host a Mexican-themed party. Meanwhile, Jim searches for someone to play a prank with, eventually turning to Pam; they steal Andy's phone, hide it in the ceiling and repeatedly call it, playing his homemade ring tone over and over. Andy becomes more angry each time the phone rings, and eventually punches a hole in the wall out of frustration. As a result of this outburst, Andy is sent to anger management training. Michael, increasingly distraught over Dwight's resignation in the previous episode, leaves and confronts him at Staples, inviting him back to Dunder Mifflin. After being confronted by Karen, Jim reveals to her that he still has feelings for Pam.
Michael exaggerates the importance of his small role in Phyllis's wedding and makes an ass out of himself, and Pam notices that Phyllis stole all of her wedding ideas from her original wedding plans.
The women of the office hold a bridal shower for Phyllis, while the men hold a bachelor's party for her groom-to-be, Bob Vance. After being convinced to hire a stripper for both the men and the women's parties by Todd Packer, Michael orders Jim and Dwight to choose the strippers. For the men's party, Dwight hires a stripper, while for the women's party, Jim hires a Ben Franklin impersonator.
Phyllis lets Michael be a part of her wedding in return for allowing her to take extra time off work for her honeymoon. Michael attempts to dominate the festivities, and acts as the host of their reception. Pam is incredulous to see Phyllis has used most of the plans for her own cancelled wedding with Roy. Feeling lonely, she approaches Roy and strikes up conversation, and they leave the wedding together.
Michael is a guest speaker for Ryan's business class, but they have a falling-out after Michael finds out that Ryan spoke negatively about Dunder-Mifflin. And back at the office, Dwight tries to kill a bat that he found in the ceiling.
In an attempt to get extra credit, Ryan invites Michael to his business school as a guest speaker. Michael attempts to make a motivational speech, unaware that Ryan has introduced him as an ineffectual manager of an out of touch company. Meanwhile, a bat is discovered in the office, leading Dwight to lead an attempt to capture it. That night, Pam displays her artwork at an art show, and is disappointed when few of her co-workers attend. Michael finally arrives after giving his speech and, in a moment of genuine kindness, compliments her work and buys her painting of their office building.
While Michael and Jan go to their first Dunder Mifflin outing as an official couple, the office workers left behind go out for happy hour. During happy hour, Roy finds out that Jim and Pam kissed at Casino Night.
Dwight saves Jim from an attack by Roy, but Dwight won't allow Jim to thank him for it. Meanwhile, Darryl asks Michael for a pay raise, and Michael discovers that he is woefully underpaid–so Michael goes to headquarters to ask for one himself.
The Dunder Mifflin CFO David Wallace holds a cocktail party at his house, which Jan, Michael, Jim, Karen and Dwight attend. Michael's antics around their “coming out” appear to annoy Jan, but she later attempts to have sex with him in a bathroom. Michael feels uncomfortable and turns her down, angering her. Meanwhile Dwight assesses the structural soundness of the house. Jim and David Wallace bond over shooting hoops when they see Dwight on the chimney. While at a bar, Pam reveals to Roy that Jim kissed her at the casino night. Roy is infuriated and proceeds to trash the bar, assisted by his brother. Pam immediately breaks up with Roy, who then declares that he's going to ‘kill’ Jim.
Roy enters the office and attempts to attack Jim, but Dwight's timely intervention with pepper spray saves Jim from injury. Roy is instantly fired, but later apologizes separately to both Jim and Pam and encourages the latter to pursue the former. Jim attempts to thank Dwight for saving him, but is frustrated when Dwight refuses to accept his thanks. Meanwhile, Michael and Darryl attempt to get a pay raise from Jan in New York.
Andy returns to the office after weeks of anger management training, determined to make a fresh start with all the Dunder-Mifflin employees. Meanwhile, it's safety training day in the office, and Michael and Dwight are on a mission to illuminate the dangers of the workplace.
Michael tries to be proactive during a watermark crisis, but only makes the situation worse. Meanwhile, Angela has trouble being apologetic with customers, and Andy discovers a secret about his new girlfriend.
Michael feels ashamed when, during a safety training course, the warehouse employees make fun of him for having a safer work environment. Determined to show that office life can be dangerous, he decides to demonstrate depression effects by faking a suicide attempt. His plan to jump off of the roof and onto a bouncy castle go awry when the employees discover what he is doing and are forced to talk him down. Meanwhile, Andy attempts to endear himself to Dwight after returning from anger management.
Phyllis gets flashed in the parking lot, and Dwight goes all out to secure the premises. Michael ostensibly takes the women in the office to the mall to comfort them, but he's really doing it to get advice about breaking up with Jan.
Paper from Dunder Mifflin Scranton with an obscene cartoon watermark left by a disgruntled paper-mill ex-employee are accidentally sent out, throwing the business into damage control. The accountants attempt to provide service for angry customers, while Michael contacts the media in a misguided attempt to avoid scandal. Meanwhile, Jim and Andy go to a local high school to apologize personally to the principal, and they bump into Andy's girlfriend, who turns out to be a student there.
Michael uses “beach day” at Dunder-Mifflin to find out which employee would be his most capable replacement, just in case he receives the promotion to the New York office that he's applied for.
After Phyllis is the victim of a flashing in the parking lot, Michael attempts to host a seminar on women's issues. When it doesn't go as expected, he takes the women of the office on a trip to the mall, while Dwight and Andy search for the flasher and distribute flyers. At the mall, Michael discusses his discomfort in his relationship with Jan, and the women advise him to break up with her. As Michael breaks up with Jan via voicemail, she suddenly arrives at the office.
Michael appoints Dwight as regional manager, anticipating that he will receive the job at corporate. Jim and Karen also interview for the same position. And Michael gets back together with Jan after she gets a boob job.
David Wallace calls and informs Michael that he is a candidate for an opening position in the corporate office in New York. Believing himself the obvious choice for the job, Michael goes about choosing a successor. He takes his employees to the beach and compels them to compete in challenges to determine which of them will take over his position, not realizing that Jim and Karen are also contenders for the job. In the evening, on a high after a firewalk, Pam confesses that she is tired of being ignored, and tells Jim that he was the reason she called off her wedding.
After evaluating their relationship, Michael decides to repel any advances that Jan makes towards him, but instantly changes his mind and gives her a second chance once he sees her with a breast enhancement. Michael, Jim, and Karen then all travel to New York to interview for the position that is opening in the corporate office. Before he leaves, Michael names Dwight as his successor in Scranton, and Dwight, with Andy as his new number two, immediately goes about changing the appearance and structure of the office. In New York, Michael's interview ends as he learns that the new position is linked to Jan's upcoming dismissal.