In an interview with Vulture, Moffat explains that a lack of any wedding details in the original Sherlock Holmes stories inspired his desire to know how it all went down. The book version had John Watson and Mary Morstan get married in between mystery insstallments, but that didn’t satisfy Moffat.
“I remember being a 12-year-old kid thinking, ‘Oh why didn’t we see Sherlock be the best man? Please can we see that?'” Moffat explains in the interview.
With no speech appearing in the Sir Arthur Conan Doyle stories, Moffat made up his own mind about what the speech would include. “I thought what Sherlock would do is he’d sit there and think, ‘Everyone’s gonna think I’m gonna make a right c***-up of this. Everyone thinks I’m going to screw it up. So I’m going to make them think that, and then of course I’m going to say something lovely,'” Moffat explains. “And I always thought he’d do it well because he’s a genius and he cares about his mate — he wouldn’t let his mate down.”
Why would a “high-functioning sociopath” like Sherlock care about this at all? According to Moffat, it’s because Holmes isn’t a sociopath at all.
Moffat’s vision of the best-man speech turned out just as he desired. “I loved writing the speech, and I don’t normally cry when I’m writing,” he says. “Sadness doesn’t make me cry. I think a simple expression of devotion probably does.”
The audience may have cried as well.