http://en.wikipedia.org/wiki/Holodeck
The first use of a "holodeck" by that name in the Star Trek universe was in the pilot episode of Star Trek: The Next Generation, "Encounter at Farpoint", although a conceptually similar "recreation room" appeared in an episode of Star Trek: the Animated Series.[citation needed]
It's interesting to notice that
The Making of Star Trek already mentioned holodeck applications, hence that "recreation room" in TAS' "Practical Joker".
Nevertheless, I think it's not too farfetched to assume that the people of Gideon ("Mark of Gideon") didn't actually build a physical replica of the TOS
Enterprise but made Kirk walk a holodeck simulation his mind was somehow creating as he moved along.
Bob