The idiom by the skin of one's teeth is defined on Dictionary.com as:
by an extremely narrow margin; just barely; scarcely
What does margin mean in the above definition? I've looked it up on OALD and it defines it as: the amount of time, or number of votes, etc. by which somebody wins something. However, the thing that confuses me is, reading the origin of the idiom on http://www.phrases.org.uk/meanings/83000.html, the idiom seems to be usually used in regard to a narrow escape from a disaster, and that appears to have nothing to do with winning like it's defined on the definition of margin from OALD. Or does margin here in the definition mean something else?