When offered a cup of tea, Sherlock replies that he'd need something stronger - 7% stronger. The original Sherlock Holmes used a 7% solution of cocaine when he didn't have a case and "wanted to stimulate his mind."
In the original script, John was supposed to be driving the Land Rover with Sherlock as the passenger. But Martin Freeman did not know how to drive at the time.
Sherlock knows that Lestrade just returned from holiday because of his tan. In real life, Rupert Graves was tan because he had just returned from Guadeloupe while filming Death in Paradise (2011). His tan was written into the script.
John tells Sherlock that he has just solved a case by "harpooning a dead pig". This is a reference to the Sherlock Holmes short story "The Adventure of Black Peter".
The quote "Once you've ruled out the impossible, whatever remains, however improbable, must be true" (from Sir Arthur Conan Doyle's 'The Sign of the Four') is used by Sherlock. A minute later Watson jokingly calls him "Spock." In Star Trek VI: The Undiscovered Country (1991), Spock uses the same line, stating that an ancestor of his used the same quote.