by the skin of (one's) teeth
Barely. Often used to describe something that almost didn't happen. Oh man, my car wouldn't start this morning—I just made it here by the skin of my teeth!
skin of your teeth
The narrowest of margins. Job 19:20 has its protagonist say, “I am nothing but skin and bones; I have escaped with only the skin of my teeth.” That is to say, Job's gums, the skin that held his teeth in place, which would indeed have been a narrow margin.