On Wednesday night, David Letterman — the longest-reigning late-night host in television history — officially ended his run on “The Late Show” with a historic final episode.

The 80-minute episode was packed with celebrity guests, video montages, flashbacks of famous sketches and much gratitude from the host, who thanked a long list of people who helped build his historic career.

Here’s a complete recap, starting with four presidents and ending with an emotional performance by Letterman’s favorite band, the Foo Fighters.

11:35 p.m.: “Our long national nightmare is over.” Those are the words that kick off the episode, with previously filmed lines from George H.W. Bush; George W. Bush; Bill Clinton and President Obama.

“Letterman is retiring,” Obama adds. All of a sudden, Letterman appeared next to him: “You’re just kidding, right?” he asked. Cue faux-serious looks to the camera.

11:37 p.m.: Letterman walks out on stage to massive applause — of course, he can’t settle down the audience, chanting “Dave! Dave! Dave!”

“Stop right there,” Letterman commanded. “See, now what happens? We don’t have time for ‘giving gifts to the audience’ segment.”

11:39 p.m.: “I’ll be honest … it’s beginning to look like I’m not going to get ‘The Tonight Show,'” Letterman says. (Who had first “Tonight Show” reference at four minutes into the monologue? Collect your winnings.)

Lots of retirement jokes: When did Letterman know it was time to retire? When Todd, the cue card kid, “came up to me and said ‘For the love of God, Dave, I can’t write the words any bigger.'”

11:41 p.m.: A new segment: “Comedy We Would Have Done Tomorrow” includes jokes about Hillary Clinton and “Mad Max,” of course.

One downside to not having your own show anymore, Letterman adds: When he messes up, he’s going to have to go on someone else’s show to apologize.

11:44 p.m.: The hottest show when Letterman first started in late-night? “Keeping Up with the Gabors,” of course! (See, he really loves Zsa Zsa Gabor.)

Letterman also finds it suspicious that Elian Gonzales now decides he wants to come back to America — should Dave be offended?

11:46 p.m.: Paul Shaffer gets a shout-out: “My good friend Paul, more than a guy who’s on television with me every night, a great friend, best friend and a wonderful guy.” Letterman claims he and Paul are taking their show to Vegas with their white tigers.

Throw in a “Wheel of Fortune” sight gag, and that concludes the monologue:

11:53: Before we go any further, Letterman has a quick word to his replacement, Stephen Colbert: “I’m very excited, I think he’s going to do a wonderful job, and I wish Stephen and his staff and crew nothing  but the best.”

Flashback time: Letterman over the years chatting with kids. He’s got a natural rapport, especially when making fun of their science projects. “The kids love me, ladies and gentleman,” he says.

12:04 a.m.: Final Top 10 list — the category is “Top 10 Things I’ve Always Wanted to Say to Dave.” It’s a celebrity-studded presentation: “I appreciate their time, their talents and their generosity,” Letterman says as the line-up began.

10) Alec Baldwin: “Of all the talk shows, yours is most geographically convenient to my home.”
9) Barbara Walters: “Did you know that you wear the same cologne as Muammar Qaddafi?”
8) Steve Martin: “Your extensive plastic surgery was a necessity and a mistake.”
7) Jerry Seinfeld: “I have no idea what I’ll do when you go off the air. You know, I just thought something — I’ll be fine.”
6) Jim Carrey: “Honestly, Dave, I’ve always found you to be a bit of an over-actor.”
5) Chris Rock: “I’m just glad your show is being given to another white guy.” (“You know, I had nothing to do with that,” Letterman shot back.)
4) Julia Louis-Dreyfus: “Thanks for letting me take part in another hugely disappointing series finale.” (Naturally, the camera panned to Seinfeld looking distraught. Letterman: “I had nothing to do with that either!”)
3) Peyton Manning: “You are to comedy what I am to comedy.”
2) Tina Fey: “Thanks for finally proving men can be funny.”
1) Bill Murray: “I’ll never have the money I owe you.”

Letterman goes down the line and thanks every single one of them — and seems most excited about Peyton Manning.

12:15 a.m.: “Tremendous to see those people,” Letterman says of his Top 10 crew. “What a thrill, and I can’t begin to articulate my feelings for each and everyone of them over the years.” He continues to gush about Manning. “Did you notice me standing next to Peyton Manning, it’s like we’re twins?”

12:17 a.m.: Flashback to one of Letterman’s most famous bits from June 1996: The time he took over the drive-thru window at Taco Bell.

12:27 a.m.: A taped bit about a day in the life of Dave — here’s what he does on a typical workday:

  • Rolls up to the Ed Sullivan Theater in a chauffeured SUV wearing cargo pants and carrying a duffle bag.
  • Meets with executive producer Barbara Gaines, who chats about the guests coming up for the night.
  • Lots of meetings and ringing phones.
  • Apparently goes to the gym, then sits back and throws peanuts into a glass of water in his office. “You know what I’m going to devote the rest of my life to?” he asks the person behind the camera. “Social media.”
  • Monologue rehearsal. “How come when Bieber crashes the high school prom it’s cool, when I do it, it’s creepy?”
  • More show prep: Letterman watches White House correspondents’ dinner footage to get ideas for jokes.
  • Quick rundown of the show in a conference room — Paul Shaffer briefly crashes.
  • Dave runs on stage for the show.

12:37 a.m.: Letterman gets serious and runs down his list of thank-yous.

“The last six weeks, it’s been crazy. People have been saying lovely things about us and it’s really been over the top. I can’t tell you how flattering, embarrassing and gratifying it has all been,” he says.

“We’ve done over 6,000 shows,” he continues. “I was here for most of them — and I can tell you a pretty high percentage of those shows just absolutely sucked. And also in light of all of this praise, merited or not, do me a favor: Save a little for my funeral.”

He recalls visiting the Ed Sullivan Theater when he came to CBS, which was a total dump — it was crawling with rats and not fit for human consumption, Letterman swears. He thanks everyone who turned it into the beautiful theater it is now.

To CBS Corporation CEO Les Moonves: “This man, over the years, has been a friend to the show, he’s  been very supportive of the show and he’s been more than patient with me. And if this was a printed sheet of paper, you could underline ‘patient’ several dozen times. So I would like to thank Mr. Moonves for that support.”

He thanks all the behind-the-scenes people: Props, audio cameras, wardrobe, makeup, etc. “These people, night after night, have put up with my nonsense and taken care of not just me but everybody on the show.”

More gratitude: The staff, the researchers, the talent coordinators, segment producers, producers, people in the control room. (He asks them to keep it to just three drinks for the last night.)

The writers: “I have been blessed and lucky to work with men and women who are smarter than I am and funnier than I am and I have always been interested in doing the show that the writers have given me. These people that I collectively have just now mentioned and introduced, believe me, this is absolutely the truth, deserve more credit for this show than I ever will. Thank you to all of those people.”

Even more thanks: Announcer Alan Kalter; Biff Henderson; the band; and his good friend, “as good a friend as you can have in life,” band leader Paul Shaffer. “It’s so obvious every night and again tonight that they are so much better at their job than I am at my job.”

12:42 a.m.: Letterman thanks his beloved mom, a frequent guest. His mom’s response when he invited her on the show for the first time: “You have a show?”

He thanks his wife, Regina, and 11-year-old son, Harry. They’re in the audience, a rare scene — the audience gives them both a standing ovation. “Look at that kid!” Letterman beams. “Thank you for being my family. I love you both. And really, nothing else matters, does it?”

12:44 a.m.: Now, time for the fans: “The people who watch this show, there’s nothing I can do to ever repay you. Thank you for everything. You’ve given me everything. Thank you again.”

12:45 a.m.: Foo Fighters time.

“These people saved my life,” Letterman says of the band, recalling the days of his open-heart surgery. He requested the band on his first episode back to play a song that was especially meaningful to him during his recovery (“Everlong”), but it turned out they were on tour in South America. But then they canceled the tour — and made it back in time to play the song. “Happily, ever since, we’ve been joined at the hip. God bless you gentlemen,” he says, gesturing to Dave Grohl and the band.

“Alright, that’s pretty much all I got,” Letterman concludes. “The only thing I have left to do, for the last time on a television program: Thank you. And good night.”

With that, the band launches into “Everlong,” while a montage of Letterman scenes from the last 33 years plays on the screen.

On May 20, David Letterman hosted his last show, ending a 33-year career on late-night television. Here are some of his top moments from CBS's "The Late Show with David Letterman" and NBC's "Late Night." (Jayne W. Orenstein/The Washington Post)

READ MORE: