After 12 seasons and 279 episodes, “The Big Bang Theory” ended its run on Thursday with an emotional finale that revealed some big news, tied up loose ends, and even featured a celebrity cameo.

In the first of two back-to-back episodes, scientists Sheldon Cooper (Jim Parsons) and his wife Amy (Mayim Bialik) receive the news they’ve eagerly awaited for so long — they are receiving the Nobel Prize in physics for their theory of super asymmetry.

However, the two don’t react very well to the news, especially Sheldon, who can’t handle his everyday life changing. One recent development he doesn’t take in stride is the now-functional elevator, the disrepair of which had been a running gag on the show since its first season.

Although earlier this season Penny (Kaley Cuocuo) told her husband Leonard (Johnny Galecki) that she never wanted kids, part two of the finale reveals that she is pregnant. But when Sheldon dismisses her announcement, Leonard angrily says “to hell with” his Nobel Prize. When his friends threaten to leave at his poor treatment of them, Sheldon takes time to self reflect.

At the Nobel ceremony in Sweden, Amy encourages little girls “who dream about science” to go for it. In a cameo appearance, Sarah Michelle Gellar sits next to Raj (Kunal Nayyar) in the audience, but assures him it’s “not a date.”

Sheldon gives an uncharacteristically heartfelt acceptance speech that, to fans who’ve been tuning in since the show’s beginning, shows how much the character has grown out of his egotistical and selfish personality over the course of 12 seasons.

“I have a very long and somewhat self-centered speech here, but I’d like to set it aside. Because this honor doesn’t just belong to me; I wouldn’t be up here if it weren’t for some very important people in my life,” he says, and thanks his family and his “other family.” “I was under a misapprehension that my accomplishments were mine alone. Nothing could be further from the truth. I have been encouraged, sustained, inspired, and tolerated, not only by my wife, but by the greatest group of friends anyone ever had.”

He asks his friends, including Leonard, Penny, Raj, Howard (Simon Helberg), and Bernadette (Melissa Rauch), to stand.

“I was there the moment when Leonard and Penny met. He said to me that their babies would be smart and beautiful. And now that they’re expecting, I have no doubt that that will be the case,” Sheldon says, accidentally revealing the baby news even before Penny’s parents know. “I apologize if I haven’t been the friend that you deserve. But I want you to know, in my way, I love you all.”

The second part ended, like many had in the show’s tenure, with the gang hanging out in Leonard’s living room and eating Chinese takeout. And fittingly, a stripped-down version of the show’s theme song by the Barenaked Ladies drew the episode, and the show, to a close.

A special, “Unraveling the Mystery: A Big Bang Farewell,” is airing at 9:30 p.m. ET. It stars Galecki and Cuoco as they take viewers behind the scenes of the long-running series.

“The Big Bang Theory” premiered on Sept. 24, 2007, and for most of its run, was primetime’s most-watched comedy series. It remains one of the most successful sitcoms in TV history — and the longest-running multi-cam comedy of all time (recently surpassing “Cheers”). It has generated an estimated $1 billion and counting in syndication. The show has received 52 Emmy Award nominations and 10 wins, seven Golden Globe nominations, and the spinoff prequel, “Young Sheldon.”

Co-creator Chuck Lorre, speaking to Variety, said even though the show has wrapped up, it’s never truly the end.

“It feels not like a finale so much as a transition. Life goes on. We’re leaving them, they’re not leaving us. We’re not blowing the show up at the end. We’re just moving away,” said Lorre.