in phrase to the nines "to perfection, fully, elaborately" (1787) first attested in Burns, apparently preserves the ancient notion of the perfection of the number as three times three (such as the nine Muses, the Nine Worthies, ancient personages famous for bravery, and the nine orders of angels).
[T]he Book of St. Albans, in the sections on blasonry, lays great stress on the nines in which all perfect things (orders of angels, virtues, articles of chivalry, differences of coat armour, etc.) occur. [Weekley]
No one seems to consider that it might be a corruption and misdivision of to then anes, literally "for the one (purpose or occasion)," a similar construction to that which yielded nonce (q.v.). Century Dictionary suspects it is a corruption of Middle English to then eyne "to the eyes."
mid-14c., masonrie, "stonework, a construction of dressed or fitted stones;" late 14c., "art or occupation of a mason;" from Old French maçonerie (14c.), from maçon (see mason).