It was the kind of trap any modern-day Sherlock Holmes would be proud of.