Star Trek: TNG -- The Long Goodbye

Star Trek: The Next Generation, series 1, episode 11.(IMDB link)

Warnings
Lots of holodeck-based alternate reality.