As I remember the story, which I got from Stan Hugill thirty years ago in a pub near Paddington station, the song relates to apprentice seamen finishing their indentures. A straw horse was hoisted to the masthead and burned, while the song was sung to accompany the process.The expression dead as a nail does not stem from the nail as we know it in modern times. A nail three centuries ago was any piece of iron longer than it was wide. The phrase cash on the nail relates to the way that merchants in Bristol did business, across what we would nowadays term bollards, in the open air. All the business was transacted at the dockside; cash on the nail meant that the transaction was paid for at once, on top of the bollard, no delay to go back for funds. Dead as a nail meant that the dead person resembled a billet of iron. On the other hand, nails were hammered into doors to deflect blows from axes,etc. Dead as a doornail is an extension of the concept of dead as a nail; dead as a nail in the lamproom door, which would be armoured as a matter of course, is an extension of both concepts. And now that that's the opposite, that's twice upon a time!