Stardate 42286.3 : the Enterprise is waiting to rendezvous with the USS Victory. Geordi La Forge shows Data a model of the original HMS Victory sailing ship. It reminds Data of his holodeck recreations of Sherlock Holmes stories and in the time before the Victory arrives, Geordi offers to accompany Data in the role of Dr. Watson on his next adventure.
Data and Geordi, in costume, go to Holmes' sitting room in Holodeck Two. Inspector Lestrade arrives with an anxious foreign emissary he claims was accosted by Gypsies who stole a photograph. Data rips the emissary's jacket open, reveals the photograph, announces that the emissary works against the King of Bohemia, and continues in much the same vein. Geordi freezes the program and barges out of the holodeck.
In Ten Forward, Geordi expresses his frustration in experiencing a Holmes mystery to which Data already knows the outcome, and explains the fun is in the mystery itself. Dr. Pulaski overhears the discussion and argues that Data is a computer that can only mimic Holmes and not solve a unique Holmes mystery. Geordi disagrees saying Data has exceptional deduction skills and bets he can solve an original mystery. Pulaski accepts the challenge.
In the holodeck, Geordi, Data, and Pulaski enter the fog-shrouded thoroughfares of 1890's London. A vendor shouts that he has been robbed and the trio witness a man running off, but Data says it's a ruse. He begins to reveal the real mystery but Pulaski cries foul and claims that Data didn't deduce anything and simply recognized elements from two different Holmes stories. Geordi calls for the holodeck arch and asks the computer for an original scenario that Sir Arthur Conan Doyle hasn't written, and to "create an adversary capable of defeating Data". As the three head back into the streets, they fail to notice a well dressed gentleman in the shadows, who has witnessed Geordi's instructions. He turns saying "arch", the holodeck arch appears, and we discover that the man is Professor Moriarty.
Data and Geordi hear a scream behind them and find Dr. Pulaski missing. Data announces that Pulaski has been abducted by two men and proceeds exclaiming; "The game is afoot! Come, Watson!" The captor's trail leads into an alley where a crowd has gathered and where Inspector Lestrade claims there has been a murder and points to a man on the ground. Data deduces that the man was killed by his wife who dreaded his release from prison, and both he and Geordi resume following Pulaski's trail which leads to a warehouse. Inside, Data finds a secret door to a sitting room. Geordi mentions this has become a game worth playing, but suddenly a voice from behind them speaks... "The time for games is over."
Data recognizes Professor Moriarty, who greets his visitors, calling Data "Holmes â but not Holmes", and Geordi "Watson â but not Watson". He says Dr. Pulaski is safe, but adds his mind is crowded with thoughts and images he doesn't understand, for example, a great power called "Computer" which controls everything. He calls for the arch, which appears as commanded to Geordi and Data's astonishment, and adds that the Computer has shown him a monstrous shape afloat in a vast emptiness. He hands a paper to Data who hurriedly walks out with Geordi following. Data tells the computer to terminate the program, but it denies access. Data tells Geordi they must see the Captain immediately and holds up the paper which shows an outline sketch of the Enterprise.
Data and Geordi meet with Captain Picard, Commander Riker, and Lieutenant Worf. Geordi explains the bet he made with Pulaski then suddenly realizes his mistake, announcing the computer didn't make an opponent for Holmes, but for Data. Picard is concerned that if Moriarty can call the arch then he must have access to the main computer. Data confirms that would be necessary to defeat him and that to defeat him, Moriarty required consciousness. Suddenly the Enterprise is racked by turbulence; the computer states that stabilization control was momentarily routed to holodeck two.
Entertaining Dr. Pulaski, Moriarty explains that the computer has informed him they are within a vast ship that sails the stars, but Pulaski feigns ignorance and says it's time for her to leave; Moriarty points to another drawing of the Enterprise on his chalkboard. Pulaski confirms her destination and asks if he'd like to join her.
Picard, now in costume himself, arrives at the holodeck with Data, Geordi, and Worf in tow. The holodeck environment chaotically changes around them phasing in and out. Picard suggests Moriarty is destabilizing the program. At the warehouse, they find Moriarty with Pulaski. Picard tells Moriarty he was created to defeat Holmes, his purpose is done and he must now deactivate. Moriarty states he has become so much more and pulls a lever next to him which shakes the Enterprise. Moriarty says he can affect this vessel as well as inflict bodily harm if he wishes. Picard angrily steps forward and demands to know what Moriarty wants. Moriarty answers that he wants to continue to exist. Picard asserts that Moriarty is not alive and just a computer conjuration, but Moriarty refuses to believe it. Moriarty says he was conjured because someone asked for a character capable of defeating Data, but he is no longer that creation â he is alive and aware. Moriarty says he wants an existence beyond the holodeck, but Picard says that isn't possible because they cannot convert holodeck matter into a more permanent form.
Moriarty claims it a pity, saying what he has learned so far has fascinated him, and he does not want to die. Picard admits he does not want to kill him. Moriarty calls for the arch and releases control back to the main computer. Picard tells Moriarty that the ship has a vast computer memory and they will save his program. If they find a way to bring him back in a form capable of leaving the holodeck, they will. Picard tells the computer to save the Moriarty program and discontinue. Moriarty vanishes.
Back in Engineering Picard and Geordi are looking over the Victory model. Geordi states she cracked a spar when the ship was shaken, but otherwise she weathered well. Riker reports that the starship Victory has arrived. Picard asks Geordi of the model "Will she sail?". Geordi replies "Yes sir". Picard responds, "Then so shall we."