Trent's Last Case is

Warning: Wikipedia contains spoilers

Trent's Last Case is actually about gentleman sleuth Philip Trent's first case. The novel is a whodunnit whose unique place in the history of detective fiction is due to the fact that it is at the same time the first major send-up of that very genre: Not only does Trent fall in love with one of the primary suspects -- usually considered a no-no --, he also, after painstakingly collecting all the evidence, draws all the wrong conclusions. Convinced that he has tracked down the murderer of a business tycoon who was shot in his mansion, he is told by the real perpetrator over dinner what mistakes in the logical deduction of the solution of the crime he has made. On hearing what really happened, Trent vows that he will never again attempt to dabble in crime detection.