Tinker Tenor Doctor Spy

The Doctor programs himself with the ability to daydream. When an alien spy gains access to the Doctor's visions he mistakes them for reality.