This was the third "holodeck malfunction" episode on TNG, after season 1's "The Big Goodbye" and "1101001". Those were solid episodes, but this one is definitely an improvement. The writing is better, the acting is better, and there is a great villain to spice things up.
The initial plot -- Geordi and Data fooling around with a Sherlock Holmes holodeck program -- is fun but thin, the kind of thing that (particularly with the overused "teaching Data to be human" theme) would have generated a mediocre episode on its own. But once we realize that Dr. Moriarty has the power to wreak havoc (his discovery of the holodeck's nature), things pick up considerably.
That said, I would have hesitated to rate this episode as anything above "solid" or "average" had it not included the closing dialogue between Picard and Moriarty - a nicely poignant bit of writing acted out superbly by Patrick Stewart and Daniel Davis. This is one case where a great ending gives substance to everything that happened before.