Just days after the world counted down to the start of a new year, CBS’s How I Met Your Mother this week surprised viewers by — we now realize in retrospect — counting down to the end of Marvin Eriksen Sr.’s life. It was a stark twist served up at the end of an otherwise light episode. Series cocreator Carter Bays spoke with TVLine about the comedy’s decision to follow in the footsteps of some revered sitcom predecessors by dipping into the drama well.

TVLINE: Had you decided heading into this season that Marshall (played by Jason Segel) would lose his dad (Bill Fagerbakke)?

This was a sort of right of passage that we knew we wanted to take the characters through. We structured the season as the “before” and “after” – the first 12 episodes of the season were setting up the situation, and now it will all unfold. We’ve explored a lot of other big mileposts — most of them are pretty happy, some of them are sad. This is certainly one of the saddest, but it felt like something we wanted to see our characters grapple with.

TVLINE: What TV comedy precedents did you have in mind as you approached this episode?

Definitely Cheers. And Family Ties, especially. When [HIMYM cocreator] Craig [Thomas] and I were first developing this show, those were two that we wanted to emulate in that regard. On Family Ties, you could do an episode where a character deals with alcoholism or Alex’s friend dies in a car accident…. Or Coach [dying] on Cheers. What made those stories heartbreaking is that you love these characters so much, and our goal with this show was to create characters you love. The great thing about Cheers is that all of the comedy came from character. As a result, all the drama, when they did it, came from character as well.

RELATED: Ask Ausiello: Spoilers On Chuck, How I Met Your Mother and More

TVLINE: How do you keep a darkish cloud from looming over the next episode? What will you put on our screens?

The cloud doesn’t lift right away; that’s another thing that we didn’t want to do, make this a one-off sad moment and then go back to normal. This show is a journey, and this is something Marshall and all the characters are going to deal with. It’s part of life, and the next episode (airing Jan. 17) is about trying to find humor in these moments. The next episode is thematically about how when something like this happens, you turn to your friends. So the rest of the group tries to figure out how to be there for Marshall.

TVLINE: You counted down to the big moment by “hiding” descending numbers throughout the episode. Was that device a way to soften the blow by letting viewers know that something was coming?

The countdown, for us, was a way to clue the audience in early on that something momentous was going to happen. It’s obviously dark subject matter for a sitcom, but your life can change in an instant. It’s not the most fun thing to write a sitcom about, but for all of who have felt loss, when you look back on those times you realize how little time you had. Jennifer Hendriks was the writer on the episode, and she did an excellent job with it.

RELATED: CBS Midseason: What’s New? What’s Moved?

TVLINE: What more typically funny-happy moments can viewers look forward to?

Actually, the next episode is very funny. Danny Strong — who Buffy fans will remember as Jonathan, but more recently has been on Mad Men – has a funny bit as an old high school classmate of Marshall’s. We go back to Minnesota for the funeral and we run into this guy who was a bully that picked on Marshall. That presents a very funny dynamic.

HIMYM fans, what did you think of this week’s dramatic turn?