(g hard). To take the gilt off the gingerbread. To destroy the illusion. The reference is to gingerbread watches, men, and other gilded toys, sold at fairs. These eatables were common even in the reign of Henry IV., but were then made of honey instead of treacle.
Source: Dictionary of Phrase and Fable, E. Cobham Brewer, 1894
More on Gilt from Infoplease: