Green’s Dictionary of Slang

nightcap n.2

[SE nightcap, a bed hat; a final drink before bedtime]

1. a condemned prisoner’s head mask worn when being hanged.

[UK]Devizes & Wilts Gaz. 27 Aug. 4/2: On the scaffold the tall grave man in black twisted him round swiftly [...] and drawing from his pocket a nightcap, pulled it tight over the patient’s head and face [...] I could look no longer, but shut my eyes as the last dreadful act was going on.
[UK]Manchester Eve. News 14 Apr. 4/5: After the execution of Mrs Cotton, the West Auckland poisoner, Calcraft informed the Durham gaol officials that she would be the last person he should ‘put a nightcap on’.
[Aus]V. Marshall World of Living Dead (1969) 117: By the cage door the hangman, beetle browed and brutal-faced, stands fingering with unconcern the pinion straps and ‘night cap’ of canvas.

2. the last portion of a drug prior to bed.

[US](con. 1958) R. Farina Been Down So Long (1972) 76: He [...] rolled a slender joint from Mixture Sixty-nine, with an eye to a later nightcap.

3. (US black) a small skull-cap worn by many black men.

[US]R. Klein Jailhouse Jargon and Street Sl. [unpub. ms.].

SE in slang uses

In phrases

have one’s nightcap on (v.) [fig. use of SE nightcap, a hat worn in bed; note predates SE nightcap, a final drink before bed]

to be drunk.

[UK]Gent.’s Mag. 560/1: To express the condition of an Honest Fellow [...] under the Effects of good Fellowship, [...] It is also said that he has [...] Got his Night Cap on.