hang by a hair
and hang by a thread 1. Lit. to hang by something very thin, such as a thread or a hair. The tiniest part of the mobile hung by a thread, the rest are on plastic cords.
2. and hang on by a hair; hang on by a thread Fig. to depend on something very insubstantial; to hang in the balance. Your whole argument is hanging by a thread. John isn't failing geometry, but his passing grade is just hanging by a hair.