Warning: The following contains some opinion stated as fact, which doesn’t mean it isn’t open to reasonable discussion.
While frequently thought of as being one and the same, the Detective Story and the Whodunit actually are two different items whose histories admittedly overlap frequently but are nevertheless separate. A Detective Story can do without the « Who » element in the same way that a Whodunit doesn’t necessarily need a detective. What’s more, the Whodunit is a much more recent development than the Detective Story.
The canonical founding text of crime fiction, The Murders in the Rue Morgue, is undoubtedly a detective story and a mystery as it follows C. Auguste Dupin’s investigation and resolution of a puzzling murder case – but it is not a whodunit as it lacks one key element of the genre, a cast of suspects. A whodunit to function and qualify as such requires suspicion to be cast over several characters, one of which ultimately is revealed to be the guilty party. A story in which the culprit while not known from the start also turns out not to be any of the characters we’ve been introduced to is admittdly a mystery – though a weak one – but it is not a whodunit since the « Who » is only treated as an afterthought.
None of Poe’s other detective stories is a whodunit either, even though Thou Art the Man comes close. Crime fiction in its first half-century was more concerned with mystery broadly defined (« What happened? » « Why did it happen? », « How did it happen? ») than it was with knowing who was responsible for it. One of the first novels to pay some heed to the question was Wilkie Collins’ The Moonstone, but despite the presence of Sgt. Cuff it is once again more of a mystery than a detective story stricto sensu, the truth not being reached through investigation and reasoning.
While some critics – particularly LeRoy L. Panek in its remarkable if divisive Origins of the American Detective Story – have disputed her actual links to the genre, Anna Katharine Green I think has to be credited as the earliest writer with some understanding of the importance of the « Who » question. Its overly melodramatic tone shouldn’t make one forget that The Leavenworth Case ends with the detective unmasking what was probably at the time a Least Likely Suspect. Green may not be the (only) « Mother of the Detective Novel » but she has a strong claim to be that of the Whodunit, which isn’t bad either. Another serious claimant is Australian writer Fergus Hume’s The Mystery of a Hansom Cab which also has a surprise murderer while being more focused than Green’s book. It is a long-held opinion of mine that Hansom Cab is the first genuine detective novel in the modern sense, and the fact that it is also a whodunit is one of the reasons for it. Even then the « Who » remained a question among many others until after WW1 when the Golden Age made it THE prime problem in the wake of S.S. Van Dine and Agatha Christie’s success, thus cementing in the eyes of the public the idea that the Detective Story and the Whodunit were the same thing. They are not but it shouldn’t keep us from enjoying both, especially on the many occasions when they meet in the same book.