If you love Shakespeare in general and are familiar with Hamlet but have not seen this Midsomer episode do not read beyond the next sentence, get the episode and enjoy a brilliant Hamlet pastiche. The joke in my opinion is to find out all the Hamlet similarities. (stop reading now if you do not want me to give the plot way.
Here is my list
1. The obvious one, the family name is King
2. Basic story father dies, mother remarries within short uncle, son is distraught.
3. Father was actually murdered by uncle (Claudius kills Hamlet Sr.)
4. Hamlet (Ian) tries to discover the truth
5. Hamlet (Ian) kills Polonius (Peter Baxter) almost by accident
6. Hamlet (Ian) has a nunnery scene with Ophelia (Sophie)
7. Ophelia (Sophie) does not die but goes away 2/3 within the episode, and for all we care she could be dead
8. There is a play within the play scene where the truth strikes Barnaby (the play is of course Hamlet)
9. There is an Horatio (David) who sees everything but is not really part of the action
10. There is even a Laertes (James)
11. Jones plays Rosenkrantz and Guildenstern packaged in one
12. The truth comes from beyond the grave, not a ghost but a late autopsy
13. And of course Claudius (Charles) is the bad guy
There may be more, in any case have fun... The only bad news (or good as it is the exception in the series) is that we know who the bad guy is!