Evans, 34, was 4-0 down in the decider but somehow found the mental and physical strength to win 6-7 (6-8) 7-6 (7-2) 7-6 (7-4) 4-6 6-4, BBC reported.
In a tense finale, Russian 23rd seed Khachanov saved two match points before hitting the third into the net.
Evans broke into a beaming smile before slumping exhausted into his chair.
Both players deservedly received standing ovations from an engrossed and entertained crowd on a packed outside court at Flushing Meadows.
“I just tried to keep fighting – at 4-0 I thought I was out,” Evans told Sky Sports.
“I’ve got a bad headache now. It was a hell of a match. I just want to go to bed.”
Earlier, British number ones Katie Boulter and Jack Draper moved into the second round after contrasting styles of victories.
Boulter, seeded 31st, fought back from an edgy start to win 5-7 6-2 6-1 against Belarusian qualifier Aliaksandra Sasnovich.
A short time later in New York, 25th seed Draper cruised through when Chinese number one Zhang Zhizhen retired with a knee injury as the Briton led 6-3 6-0 4-0.
But fellow Briton Emma Raducanu, champion here in 2021, lost her first-round match to Sofia Kenin.
Out of form this season, and trying to avoid dropping out of the world’s top 200, Evans battled valiantly in sweltering conditions.
He appeared to be running out of steam as Khachanov threatened to move 5-0 ahead in the decider, but held off three break points and reduced the deficit to 4-3.
Evans fed off the support of a raucous crowd to earn a victory which will live long in the memory.
“I felt a little sorry for myself, but got myself going because I didn’t want to go out of another Slam without a fight and with a whimper,” said Evans after the victory, which was his first at a major this year.
“I could see he was struggling a bit and tried to grab a game at a time.”
Each set was a battle of attrition with lengthy games and multiple break opportunities, all lasting over an hour:
Set 1 - 68 minutes
Set 2 - 67 minutes
Set 3 - 72 minutes
Set 4 - 67 minutes
Set 5 - 61 minutes
With both players gasping for breath, Evans secured victory in a match which surpassed the previous US Open record - set by Stefan Edberg and Michael Chang in the 1992 semi-finals - by nine minutes.
Evans has endured a chastening year, having won just four ATP Tour matches going into the final Grand Slam of the season.
That dire form, combined with the decision not to defend the title - and ranking points - he won in Washington last year in order to play doubles with the retiring Andy Murray at the Olympics, caused Evans to plummet out of the world’s top 175.
Beating Khachanov is a reward for his perseverance - and his generosity to Murray.
“I’ve had a horrible year. I knew I had put the work in but not enough because I was a bit hurt,” Evans added.
“I like to think I got a bit of luck at the end [against Khachanov]. I nearly blew it but I’m really happy.
“It was amazing at 4-2, it really started to get going. I don’t know how many Brits were there, but it seemed like the whole place wanted me to win.”
Evans has around 48 hours to recover before playing Argentina’s Mariano Navone in the second round on Thursday.