within an ace of
Also, within an inch of. Very close to, within a narrow margin of, as in We were within an ace of calling you, but we'd lost your phone number, or We were within an inch of buying tickets for that concert. The first term refers to the ace of dice, that is, the one pip on a die. The lowest number one can throw with a pair of dice is two (two aces), a throw that is within an ace of one. The term began to be used for other kinds of near miss by about 1700.