Conny Miller's hat is called a "Campaign Hat". They can be traced back to the mid-19th century. Made by many manufacturers. Stetson was a major producer of these hats. Soldiers found the middle crease of their hats to be impractical since it accumulated rain water. Soldiers started pushing up the center of the hat so it would shed water. Sometime in 1911, the Army adopted this style of hat as "1911 Hat, Service, M1911 (Campaign Hat.)". Unofficially it had several names "lemon squeezer", "mountie hat", "ranger hat", "drill instructor cover", "smokey bear", "the Montana crease", and several others.
Many reviewers have cited Leo Rosten's very short story "The Path Through the Cemetery" as the source of this episode. While this much-anthologized tale is probably the immediate source, there are many other available ones which include the three essential story elements: grave, wager, & knife. The oldest printed version in English to be found dates from 1825 when it appeared in the pages of THE TERRIFIC REGISTER. The story has been recently reprinted in the compilation TALES FROM THE Terrific Register: BOOK OF GHOSTS (2010) pp. 107-112. The setting is Westminster Abbey around the year 1735 when the Henry VII Chapel Vault has been opened for the admission of the Queen's body. (The Queen must be George II's consort Caroline of Ansbach who died on 20 November 1737 and is the only Queen buried in the vault anywhere near the year 1735). The only significant change is that the wielder of the knife survives his ordeal and relates much of the tale in the first person. Please be advised that THE TERRIFIC REGISTER was notorious for publishing fiction as fact and that it was probably a well-known urban legend by 1825.