Sarah Michelle Gellar made a surprise appearance on the 'Big Bang Theory' finale.

The 42-year-old actress and her hit TV series 'Buffy the Vampire Slayer' have regularly been referenced on the sitcom and on Thursday (16.05.19) night's last ever episode of the show, she made a cameo as herself when she accompanied Raj Koothrappali (Kunal Nayyar) to see Sheldon Cooper (Jim Parsons) and Amy Farrah Fowler (Mayim Bialik) accept a Nobel Prize in Sweden after meeting him on a plane and agreeing to be his guest.

Executive producers Steve Molaro and Steve Holland were delighted to get the actress on board and were thrilled to find out she was a fan of the show.

Holland told 'Entertainment Tonight': ''Steve and I are both big 'Buffy' fans - as are a lot of people in the [writers'] room.

''And rather than going for whoever is the hot 'right now' celeb, it seemed like a really cool, nerd-pull for these characters who have been fans of 'Buffy' forever too. And it was our way to get to meet her before the end.

''Chuck [Lorre, creator] spoke to her, but it's always a good sign when the first thing people say is, 'Our family are huge fans of this show!'

''That was how it went with Sean Astin too. We reached out and he's like, 'Our family are gigantic fans, we watch every week!' So then it's like you're pretty safe and then it was just a matter of working out scheduling.''

During the episode, Sarah insisted to Raj that they were not on a date, and the writing team thought it was a fitting joke to make.

Molaro explained: ''It seemed funny. We know in real life she's married to Freddie Prinze Jr. and, obviously, it's a TV show, but it was just a funny way to cover our bases and get a joke in and give her a good laugh along the way.''

In order to keep the actress' guest role secret, the cast were warned to be careful with their social media posts.

Holland said: ''Well, I mean, we filmed it the day before [audiences] saw it in the live show, so we didn't have to keep it a secret for long. Actually, we shot it that morning.''

Molaro added: ''But we had to keep telling everybody on set and on the cast, 'Please be careful on social media and please be careful not to post pictures.' ''