Within an ace of

Within an inch of / By a hair's breadth


A un pelo da...


Meanings
Very close to...; a near miss

Examples
My husband likes to play the Stock Market and he thinks is good at it, but after his last speculation we came within an inch of losing everything
Mio marito crede di saper giocare bene in Borsa, ma, in realtà, dopo la sua ultima speculazione siamo stati a un pelo dal perdere tutto

That was a near miss. An old lady, on a zebra crossing, came within an inch of being hit by a car that continued without even trying to break
C'è mancato un pelo che quella vecchietta, che attraversava sulle zebre, non venisse investita da una macchina che non ha nemmeno tentato di frenare

That would have been a shocker! The underdog came within an ace of winning Wimbledon
Questa sì sarebbe stata una sorpresa enorme! Il tennista meno favorito è arrivato a un pelo dal vincere Wimbledon

Origin
The ace of this expression is the ace of dice, that is the one pip on a die, which is the smallest amount possible. Therefore, being within an ace of something, means being extremely close to it