Dan Evans has flirted with grand deeds in New York before and, after beating the out-of-sorts Frenchman, Lucas Pouille, in four sets on Thursday, he enters the third round of the US Open with a renewed sense of purpose.

He has always had the talent. This summer he has had the results, winning half a million dollars and 13 matches on the Tour. At 29 he also has the battle-hardened maturity to take his sport seriously and the prize for his endeavours over three hours and 10 minutes under a beating sun on Court 12 to win a rain-delayed encounter 6-4, 6-3, 6-7 (4), 6-4, is a match against his new best friend, Roger Federer, on Friday – an opportunity he blew at Flushing Meadows on his second visit in 2013.

That season, when off-court turmoil was as likely to unseat him as a forehand, Evans played quite brilliantly after coming through qualifying. He beat Kei Nishikori and a still-dangerous Bernard Tomic before coming desperately close to getting past the experienced Tommy Robredo, who was making an impressive comeback. Robredo had a far bigger win in the next round: over Federer. That could have been Evans’s “night in the Garden”.

Similarly, in 2016 Evans found form at the right time but did not cash in. After beating Rajeev Ram and Alexander Zverev (before the German prodigy properly began his climb up the rankings), he had the world No 3 Stan Wawrinka at his mercy when he mis-hit a smash at match point in the fourth-set tie-break. He then failed to hold off the Swiss in the fifth set and Wawrinka went on to beat Novak Djokovic in the final.

So the mountain is not always as high as it looks. When Evans played Federer for the second time in the second round of the Australian Open this year, he took him to two tie-breaks in a high-grade three-set match.

Whether it was that showing or Federer’s curiosity about this one-time tearaway and his expansive, intelligent game that brought them together is uncertain, but theirs is one of the most interesting friendships on the tour, strengthened by a recent training stint they had in Switzerland.

As Federer said after beating Damir Dzumhur in four sets under the Arthur Ashe roof on the rain-wrecked Wednesday, “I know Danny well. He came to Switzerland to train with me. He plays really well on the fast courts. I’ll be ready. Happy to be in the third round.”

“We talked about everything, really,” Evans said of their three days together. “He was pretty open about life, what he does. Just open, normal chat. I didn’t ask him about my game, or anything like that because, as we see it, you’re not meant to play him [normally]. But I am tomorrow, so I have to go about my business and hopefully beat him.

“I have to think I can beat him otherwise there is no point going on court. I think I have got over ‘it’s Roger and he’s impossible to beat’. I have more belief going on to court.”

Pouille, too, has trained occasionally with Federer, at his winter base in Dubai, but there was no dividend evident from that experience for most of this match, as his unforced error count grew alarmingly to 81 – and on both wings. Everywhere Evans looked for a weakness, he found one, as Pouille’s backhand and forehand competed for awfulness.

All was going so well for Evans until, leading by two sets and a break with the locker room beckoning, he missed a volley to go 5-2 up on his serve in the third. This gave slim hope to an opponent who was playing woefully and broke and held to serve for the set. But his wretched form struck him down again and he dumped a regulation forehand to hand Evans parity.

If nerves or the shock of a surprise opportunity had consumed him six years against Robredo and then in the 2016 match against Wawrinka, he was faced with a similar if lesser challenge in sight of the finish line against Pouille. The enigmatic Frenchman forced two deuce points and the result was very much up in the air.

Evans, who dropped to his knees, exhausted, at the end of a long 11th game in which he had to do a lot of running to get to 6-5, could not crack the fragile Pouille serve (which was registering at a poor 45%) to avoid the tie-break, where their season’s returns were similar: 9-5 for Evans, 13-9 for Pouille.

However, Evans blew a 3-0 lead in the tie-break, handed Pouille five points in a row and could do no more than offer a limp backhand to his final, winning serve, which propelled them into a fourth set of a match the British No 3 could so easily have won half an hour earlier.

He broke at the start of the fourth frame and was looking good again, until he returned the favour and found himself under more pressure before holding grimly for 4-4. A couple of calamitous shot choices cost Pouille his serve in the ninth game and Evans served for the match, finishing the job with two match points to spare when he forced a long lob from his weary opponent.