Martin Freeman and Benedict Cumberbatch in Sherlock. BBC

First a rebirth, now a wedding. After the explosive hijinks of Sherlock's return, we were in more unfamiliar territory in The Sign of Three, a rambling and riotous caper that mixed the sitcom pairing of Holmes and Watson, a wedding murder mystery and a heart-breaking finale.

Whilst it at times struggled to manage its tonal shifts, this was a strong character-driven episode that further cemented the brilliant chemistry of Benedict Cumberbatch and Martin Freeman in the lead roles.

With an episode set around John and Mary's wedding, you'd fear the worst and think that tragedy would soon befall the celebration. But instead the majority of the episode is humorously based around Sherlock's best man speech, and his terror at delivering it. Lestrade says to Molly, "What's the worst that could happen?"

When Sherlock starts off his speech by attacking the principles of marriage and insulting everyone in the room you feel that might be it. But then through Sherlock's eloquent speech the episode flashbacks to previous adventures between the two that shows why the Baker Street sleuth values their friendship so highly.

Drunken Deductions

The most notorious flashback involves the drunken double act the two form on John's stag night. Last week gave us Sherlock as James Bond, and this time we see the two as Withnail and I, with Sherlock devising a morbid murder scene pub crawl in which the two get very, very drunk.

There were so many treats to witness here, from seeing Sherlock start a bar brawl to the two lying inebriated on the Baker Street stairs. But the standout scene was when Sherlock and John are called out to investigate an apartment whilst still intoxicated, where Sherlock claims he is "clueing for looks", and his usual on-screen text deductions are less than incisive e.g. "Egg?? Chair?? Sleeeep."

Convaluted Mystery

With director Colm McCarthy at the helm, The Sign of Three was visually toned down from last week episode, but the two nifty inventions here were this blurred drunken sequence, and the courtroom message board in which Sherlock talks to five women online who all claim to have dated a ghost. The mystery itself, involving a murdered grenadier guard and an attempt to kill John's former commander Major Sholto, was rather convoluted, but did inject some energy into this erratic episode.

The tonal shifts did take a bit of getting used to, as the episode lurched between the high farce of the drunken stag do, to the deadly seriousness of the murder, but throughout you never knew what was going to happen next, and that is one of Sherlock's greatest strengths. Previous middle episodes The Blind Banker and The Hounds of Baskerville were more run of the mill affairs, but the meandering flashbacks here served to give us an episode more focused on character, revealing the many layers that make John and Sherlock's friendship.

The Lone Dancer

It was all paid off with a powerfully poignant finale in which it dawns on Sherlock that John is starting a new chapter in his life without him. If The Empty Hearse was all about celebrating the return of Sherlock Holmes, then this episode was about how his and Watson's relationship has irrevocably changed.

The Sign of Three turns out not to be Mary joining Sherlock and John in adventures, but her pregnancy that the great detective has deduced. How far he was taken aback when John asked him to be best man, his speech, and his violin composition all reveal the depth of feeling he has towards John. But even for someone so regularly blind to human emotion, he realises the impact his best friend starting a family will have on their relationship.

Confessing previously to loving to dance, when it comes to the reception party he finds himself with no-one one to dance with, and so, as Mrs Hudson foreshadowed earlier, he becomes the sort of person who leaves a wedding early. A bittersweet note to end Sherlock's most comedic episode, things are about to get a lot darker in the series finale, His Last Vow.