come within an inch of (something)
To almost get, achieve, or experience something. She came within an inch of the gold medal, but her leg cramped in the last few meters. Hundreds of people came within an inch of death when their apartment building caught on fire in the middle of the night.
come within an inch of someone or something
and come within a hair('s breadth) of someone or somethingto come very close to someone or something. The bullet came within an inch of Heather. The car came within a hair of the bus.