The phrase is known to have been used in the 12th century. It may be associated with the numerous legends of pious women disfiguring themselves in order to protect their virginity.
The expression has since become a blanket term for (often unwise) self-destructive actions motivated purely by anger or desire for revenge. For example, if a man was angered by his wife, he might burn down their house to punish her; however, burning down her house would also mean burning down his, along with all of their possessions.
wikipedia :-)