The story
A cocked hat is one with the brim turned up to form two or three points (a bicorn or tricorn). The verb may refer: * to someone or something being knocked or hit out of shape like such a hat, or a person having a cocked hat forced on to their head; or * to a person knocking down all but three pins in a game of ninepins, or to the similar game called “cocked hat” in which only three pins are set up in a triangle, although these may simply be allusions to the shape of a tricorn. It has been pointed out that evidence linking these games to the verb is lacking.
Etymology from Wiktionary, CC BY-SA 4.0.