Last-minute rewrites, sudden cast departures, plain old improvisation: sometimes, necessity breeds invention on our favourite TV shows and sequences that featured nowhere in the original script deliver moments of pure TV gold.

Here are eight major scenes added to your favourite shows at the last minute – and the surprising reasons why.

Zombie drive-thru – from The Walking Dead, 7.09 'Rock in the Road'

this image is not availablepinterest
Bear Grylls//Digital Spy

It was the most memorable moment from The Walking Dead's season 7 midseason premiere, but the sequence, in which Rick and Michonne massacre a flock of zombies with a length of barbed wire stretched between two speeding cars, wasn't in the original script.

"It was an idea that came to me," revealed the show's executive producer (and guru of gore) Greg Nicotero. "It came about because we're very committed out of the gate to open the midseason with a – as Sam Raimi would say, 'It's a true popcorn popper, friend!'"

Molly's heartbreak – from Sherlock, 4.03

this image is not availablepinterest
Bear Grylls//Digital Spy

'The Final Problem' saw Sherlock, John and Mycroft trapped and forced to perform a series of twisted challenges by long-lost Holmes sibling Eurus. In one particularly wrenching scene, Sherlock had to make poor Molly Hooper say the words, "I love you" – or else the unwitting pathologist would be (apparently) blown to bits."What's interesting about that scene is there was a completely different scene there... and two people liked it – me and Mark [Gatiss]," revealed co-writer Steven Moffat. "Everybody else hated it and we kept insisting it was good."The original sequence had Molly trapped inside a coffin, with Sherlock solving a puzzle to free her. Given how divisive the scene as aired ended up being, maybe it would have been better to stick to the original after all?

The Jon Snow pile-on – from Game of Thrones, 6.09, 'Battle of the Bastards'

this image is not availablepinterest
Bear Grylls//Digital Spy

The 'Battle of the Bastards' was one of the most spectacular Game of Thrones episodes ever, but one of the most memorable sequences almost didn't happen at all. The scene in which Jon Snow is almost smothered by a horde of his own men? A last-minute addition.

"One day in the middle of shooting, there was a moment when I realised we just could not complete the sequence as planned," director Miguel Sapochnik explained.

Instead, he e-mailed showrunners David Benioff and Dan Weiss to "suggest an alternative that I thought we could achieve in the remaining time" and said the final, claustrophobic sequence "turned out as one of [his] favourite little moments". Ours, too.

Trumped – from South Park, 20.07, 'Oh, Jeez'

youtubeView full post on Youtube

Not just a scene, but an entire episode devised at the last minute.

South Park is famous for devising, writing and producing an episode per week, allowing the show to respond to and parody current events. But 2016's 'Oh, Jeez' was even more last-minute than usual, with Trey Parker and Matt Stone – along with the rest of the world – entirely expecting Hillary Clinton to win the US presidential election.

Instead, Donald Trump came out on top. Original episode 'The Very First Gentleman' was abandoned and a whole new plot invented in which the show's Trump analogue Mr Garrison became POTUS. 'Oh, Jeez' just about sums it up.

From: Digital Spy