This phrase came from an English puppet show, Punch and Judy that goes all the way back to the 1600s. No two performances of the show were totally alike, but they all usually involved the same events:
1. Punch kills his infant child
2. Punch punches Judy until she dies
3. Punch goes to prison and escapes using a golden key
4. He then kills doctors, lawyers, and a hangman
5. He kills Death, as in the Grim Reaper
6. Then it all ends spectacularly as he kills the Devil.