The idea for the film came from an unexplained event witnessed by co-writer Zoya Akhtar and a group of her friends as they were driving down a deserted road one night and which haunts them to this day.
Saif Ali Khan, Salman Khan and Shah Rukh Khan all turned down the lead role before the filmmakers' first choice, Aamir Khan, took the part.
Aamir Khan and director Reema Kagti decided on having a mustache to give his policeman character a darker feel. However Khan grew it so long that it was against police regulations and it was only after being informed about this from a real police officer, that he let the hair and make-up crew trim it.
Nawazuddin Siddiqui's character is called Tehmur and walks with a limp, a reference to Timur the Lame (also known as Tamerlane and Tamburlaine), a prominent Mongol conqueror of the late 14th Century and an ancestor to the Mughal Dynasty who would rule India from the 16th to the 18th century.