When the Starship Enterprise arrives three days ahead of schedule to rendezvous with the U.S.S. Victory, the crew is presented with some well-deserved free time.
Knowing that Data is a Sherlock Holmes aficionado, Geordi summons Data to the holodeck, where they travel back to Victorian London to solve one of the famed detective's mysteries. Geordi plays Dr. Watson to Data's Holmes, but the trip turns out to be a brief one — having memorized every one of the Sherlock Holmes books, Data can solve the crime with very little effort.
Returning to the U.S.S. Enterprise, Geordi tries to explain to Data the difference between deduction and memorization. Dr. Kate Pulaski overhears their conversation and challenges Data to solve a real crime, a la Sherlock Holmes. Geordi orders the computer to present Data with an original mystery and an opponent who could defeat him.
Kate joins Data and Geordi as they return to London, via the holodeck. But their game turns serious when Kate is kidnapped by Holmes' arch-enemy, Professor James Moriarty. Although they track down Kate's location, they are unable to retrieve her because Moriarty has taken control of the holodeck computer.
Leaving the holodeck, Geordi and Data apprise the crew of the situation with Kate. They learn that the computer didn't create an adversary worthy of Holmes' intelligence, but of Data's — which means Moriarty is very bright indeed! Picard insists upon returning to London with Data to rescue Kate.
Data leads Picard to Moriarty, who is still holding Kate hostage. Although Data offers to concede victory to his nemesis in order to end the charade, Moriarty wants more. He wants to leave the holodeck and become real. Luckily, Picard is able to convince Moriarty that he does not yet know how to convert artificially created holodeck matter into a more permanent form, and Moriarty releases Kate from captivity.