hang by a thread
Also, hang by a hair. Be in a risky or unstable situation, as in His promotion was hanging by a thread, or With the lead actor sick, the success of our play hung by a hair. This expression, already proverbial in the early 1500s, alludes to Damocles, who vexed King Dionysius with constant flattery. The king invited him to a banquet where Damocles found himself seated under a naked sword suspended by a single hair, symbolizing his insecure position at the court.