The earliest patent that I have found was 1853, and that was a simple peg with a slot that spread under force.
I am certain that there were many predecessors that never went through the patent office. For example, the Shaker's developed several peg-like pins for that purpose and they were never patented or sold to the public. And with all of the uses, it can also be used to hang clothes!