How I Met Your Mother’s early seasons were well-loved by critics, but one throwaway joke foreshadowed the divisive series finale of the show years before it aired without anyone noticing. A worthy successor to Friends, How I Met Your Mother was a noughties hang-out sitcom with a difference. The gimmick of this ensemble cast comedy was in its eponymous promise, with How I Met Your Mother being narrated by its main character Ted as he reminisced to his kids about the series of circumstances that led him to meet their mother decades earlier.

Although some subplots and characters were critically reviled, such as How I Met Your Mother’s ill-considered love interest Zoey and her more likable husband Kyle MacLachlan's Captain, much of the series was met with critical acclaim. The clever framing device meant that How I Met Your Mother could set up twists and foreshadow eventual reveals entire seasons in advance, lending the show a shape that few sitcoms could boast. Of course, not all of How I Met Your Mother’s callbacks were guaranteed to be crowdpleasers, with one joke being a creepy nod to the eventual series finale.

Related: Cobra Kai: Why HIMYM's Barney Probably Wouldn't Support Johnny Anymore

There’s a scene in season 5’s "Double Date" which gives viewers a glimpse at the ending of How I Met Your Mother, and it’s almost as poorly thought-out as the actual finale itself. When the gang comes across Lily’s doppelgänger, Marshall admits that he does fantasize about women other than Lily but because she’s his wife and the love of his life, he feels it’s necessary to first fantasize about her death due to an incurable disease, then “an appropriate number of years” must pass (again, in his fantasy), before he’s comfortable with the idea of then imagining sleeping with another woman, an idea Barney (reasonably) finds deeply creepy.

HIMYM Stripper Lily Alyson Hannigan

If this setup sounds familiar, it’s because this story is exactly what happens to the show’s protagonist Ted in the How I Met Your Mother’s much-hated finale. After introducing Cristin Milioti in the role and winning over fans who were worried the much-hyped mother would be an inevitable letdown, How I Met Your Mother ended with a shocking twist wherein the titular character died tragically young only one season after she was finally introduced. Fans who were just coming around to Miloti’s lovable character were devastated, but the showrunners of How I Met Your Mother explained that this was the ending they had in mind for years as the shocking twist would justify a now-far-older Ted pursuing a once-again single Robin.

This led to the much-derided closing scenes of How I Met Your Mother and caused no end of fan frustration, as the bleak fantasy Marshall outlined in "Double Date" came true for Ted and the untimely death of his wife allowed him to pursue another woman. It’s a dark joke with an even darker pay-off, so it’s no surprise that many fans wanted an alternate ending for How I Met Your Mother.

More: Every How I Met Your Mother Halloween Episode