A wistful Craig Ferguson wrapped a 10-year run on CBS’ “The Late Late Show” on Friday with a surprise closing segment that paid tribute to a handful of classic TV series finales.

SPOILER ALERT: Stop reading if you haven’t seen Friday’s edition of “The Late Late Show with Craig Ferguson.”

Ferguson signed off after 2,058 episodes in characteristically quirky fashion, running through many of the show’s regular comedy bits, such as bantering with sidekick Geoff the talking robot skeleton and showcasing Secretariat, the show’s “fake horse” brought to life by two people in a classic pantomime horse costume.

The guest segment featured Jay Leno in a candid, and for Ferguson fairly low-key, session of swapping stories of talkshow host gripes about lame guests, pushy publicists and the trials of aging on the job. Leno, who signed off “The Tonight Show” in February, looked like a guy who’s been semi-retired for 10 months, with a shaggier mop of silver hair and more casual look than he sported on NBC’s air all those years. He assured Ferguson that great experiences awaited him on the standup circuit.

“It’s fun being a comedian again instead of a talk show host,” Leno said.

Instead of the usual cold open with Ferguson peering into the camera, the show began with a pre-taped musical number. Ferguson harked back to his roots in new wave bands by belting out the anthem “Bang Your Drum” accompanied by the show’s semi-regular band Bone Patrol. The seg featured a slew of cameo clips of celebs banging various percussive objects, including Jimmy Kimmel, Jon Hamm, Jeff Daniels, Julia Louis-Dreyfus, Matthew McConaughey, Ted Danson, Lisa Kudrow and even Archbishop Desmond Tutu — the guest who helped Ferguson win a Peabody award in 2010.

The closing moments took an unexpected turn when Ferguson decided to reveal who was inside Secretariat. It turned out to be Bob Newhart, which lead to a camera dissolve and cut to a bedroom scene reminiscent of the famous “Newhart” series finale in 1990 in which star Newhart referenced his 1970s “Bob Newhart Show” by waking up in bed with his former TV wife, Suzanne Pleshette, and revealing that the 1980s “Newhart” had all been a dream.

Ferguson woke up in bed next to Drew Carey, the star of the 1996-2004 ABC sitcom where Ferguson first made a name for himself in the U.S. Carey and Ferguson have long been neighbors on the CBS Television City lot, where Carey now hosts “The Price is Right.”

Beyond “Newhart,” the closing moments also featured Journey’s “Don’t Stop Believin’ ” — a callout to the famously controversial ending of HBO’s “The Sopranos.” And the camera zoomed in on a snow globe, which referenced the famous ending of the 1980s NBC hospital soap “St. Elsewhere” that was revealed to be the fantasy of an autistic boy.

At the start of the show, Ferguson said his requisite thank yous to the production staff and to viewers. And he made a point of telling the aud to stay tuned for his next career move.

“I’m not retiring,” he said. “I’m not stopping doing it, I’m stopping doing this.”

Ferguson hinted that he was pursuing a show that would air much earlier than the 12:37-1:37 a.m. time slot of “The Late Late Show,” but he did not get specific about the syndicated series that is being assembled for early evening time slots with Tribune Media stations and distributor Debmar-Mercury.

By his own standard, Ferguson was surprisingly low-key throughout the episode (“I really feel for people who are tuning in for the first time,” he joked). But he did have heartfelt words of appreciation for viewers for embracing his most unconventional style. He also gave plenty of screen time to his longtime producer Michael Naidus.

“You came to a show that — let’s be honest — was a bit of a fixer-upper and it kind of stayed that way,” Ferguson said. “Maybe ‘art’ is a very grand word. What I was trying to do here is to make something that wasn’t here before.” The Scotland native said his greatest satisfaction came from gaining the familiarity that allowed him to “make a connection with a country which I became a part of,” referencing his naturalization as an American citizen in 2008 (he has dual status in the U.S. and Britain).

And Ferguson also hinted that he was tired of the high drama that surrounds the latenight biz. “I can’t be a member of club that I didn’t really want to join,” he said. Later in the hour Leno praised Ferguson for always being “fair” and never getting wrapped up in “the latenight talk show snippy club,” a veiled nod to the criticism from other comics that Leno has long endured.

Although Ferguson was David Letterman’s companion show for a decade, it’s no secret that the two never had a particularly warm relationship. The choice of Leno as Ferguson’s final guest also speaks volumes.

The conversation with Leno offered a few lighter insights, such as the fact that Leno and Larry King urged Ferguson not to quit the show, and the fact that Ferguson gave Leno, a noted collector of automobiles, the gag gift of a beat-up 1967 Ford Bronco that once belonged to Danny Bonaduce.

Ferguson’s sign off came on the heels of Thursday’s well-received “Colbert Report” finale on Comedy Central. But the most momentous goodbye in latenight is still to come in May, when David Letterman bows out after 33 years and hands CBS’ “Late Show” baton to Stephen Colbert. James Corden, another British actor-comedian, takes over “The Late Late Show” on March 23.