within an ace of (doing) something
From Longman Dictionary of Contemporary Englishwithin an ace of (doing) somethingwithin an ace of (doing) somethingALMOSTvery close to doing or achieving something The team came within an ace of winning the championship. → aceExamples from the Corpuswithin an ace of (doing) something• I came within an ace of slapping her around.