[spoiler]It’s a Superintendent Battle story, where our hero dispassionately hunts for truth like the pride of Scotland Yard should.
(Interestingly, the villain’s first-known crime uses the get-away-with-murder strategy Poirot recommends in CURTAIN as the easiest-and-best method he’d personally employ to kill someone and make it look like an accident; it of course works, placating the authorities and leaving only an amateur sleuth with unprovable suspicions; the villain then kills that sleuth, and makes it look like natural causes; and there’s yet another death that everyone thought was an accident, and which Battle still can’t be sure wasn’t murder as the book ends.)
(If not for switching to that frame-himself-and-frame-someone-else-for-framing-him tactic, his usual plan may well have worked yet again – though even then, he only winds up confessing because Battle confronts the guy with fake evidence in best Columbo fashion; as ever, there wasn’t really a witness.)[/spoiler]
In the science-fiction novel Altered Carbon, the main character is hired to solve the murder of an old rich dude by the backup copy of the old rich dude himself. The cops said it was suicide and refuse to investigate any more, and the guy thinks that there’s a huge conspiracy of some sort going on.
As it turns out, there in fact was a huge conspiracy, but it didn’t involve the cops, and the guy actually did commit suicide. Upon discovering this, the main character is extorted into convincing his employer that he committed suicide for a different reason than he actually did.
Not a mystery novel but I think there was a Big Valley episode where a guy that Jarrod was self-righteously defending against a murder charge was actually guilty.
This is also the plot of at least one Phoenix Wright case, or, at least, the first half. The second half has to do with the fact that you, as a defense lawyer, now have to defend someone you know is guilty.
Also, here’s my suggestion for dealing with spoilers like that: mention something in the book that only those who have read it would know. For example, mention the book where the guy who was killed by the genie actually wound up doing it.
Who Censored Roger Rabbit. Roger hires Eddie Valiant to find out if why he can’t get his own strip, but in the course of the investigation Roger is killed (but his doppelganger remains), and his boss is murdered and the evidence points to Roger doing it. Eddie takes the case to find who murdered Roger’s boss, among other things.
The idea, I find, even predates Sherlock Holmes. I’ve been reading Wilkie Collins’ The Moonstone, which was written in 1868. Although the OP’s suggestion wasn’t at the heart of the novel, it’s certainly considered. In Second Period, Chapter III. The novel concerns the theft of a diamond, the titular Moonstone.