 " The Girl in the Fireplace " is the fourth episode of series two of the British science fiction television series Doctor Who . It was first broadcast on 6 May 2006 on the British Broadcasting Corporation ( BBC ) , was directed by Euros Lyn and is the only episode in the 2006 series written by Steven Moffat . Sophia Myles guest @-@ starred as the historical figure Madame de Pompadour . The episode is inspired by Audrey Niffenegger 's novel The Time @-@ Traveler 's Wife . 
