The universe has been finding ways to mess with people long before Edward A. Murphy uttered his famed statement in the aftermath of Dr. John Paul Stapp strapping himself onto a rocket powered sled. One of the earliest instances of this "law" being stated explicitly happened in 1877 where Alfred Holt, in an address to the Institution of Civil Engineers, said, "It is found that anything that can go wrong at sea generally does go wrong sooner or later…"
By 1908, it had become a well-loved maxim among magicians as well, as explained by Nevil Maskelyne in The Magic Circular: "It is an experience common to all men to find that, on any special occasion . . . everything that can go wrong will go wrong…"
This was reiterated by Adam Hull Shirk in The Sphinx in 1928, "It is an established fact that in nine cases out of ten whatever can go wrong in a magical performance will do so."