The two-time gold medallist looked set to be playing his final game, but Team GB prevailed 2-6 7-6 (7-5) 11-9 on Court Suzanne Lenglen.
Nishikori and Daniels, who were both eliminated from the men's singles competition earlier in the day, were keen to make amends and broke the British pair twice in the last four games of the opening set to draw first blood.
Murray and Evans responded well and replied to two breaks in the second set to force a tie-break, in which they held their nerve to level.
In the final set decider, the curtain looked sure to come down on Murray's glittering career, but the Brits survived five match points to level the tie-break at 9-9 before remarkably booking their place in the next round.
Data Debrief: From the jaws of defeat
Nishikori and Daniels could not have asked for a better first set as they brushed their opponents aside, making just four unforced errors to Team GB's 10.
However, Murray and Evans' resilience kicked in, and they saved two break points in the second set. In the decider, they won the last seven points to storm through, leaving their opponents shocked.
In an already memorable tournament for Murray, he has just played a match that will live long in the memory.
The Serbian cruised into the semi-finals of the singles tournament with an emphatic 6-2 6-0 win over home favourite Kei Nishikori of Japan, then teamed up with Nina Stojanovic to beat German pair Laura Siegemund and Kevin Krawietz in the mixed doubles quarter-finals.
World number one Djokovic, 34, is attempting to become the first man to win all four tennis singles grand slam titles and an Olympic gold in the same year.
He has already triumphed at the Australian Open, French Open and Wimbledon, leaving just Tokyo and the US Open to conquer.
Asked after his doubles win if this was the best year of his career, Djokovic replied: "I don't know. Today was the best day of this tournament because I've played my best tennis so far."
Those comments echoed his assessment of the Nishikori match, after which he said: "I'm very happy – my best performance in the tournament."
Djokovic said he "had an answer for everything [Nishikori] had" and now he will face Alexander Zverev.
Asked how confident he felt heading into the last four, the 20-time grand slam champion replied: "Very."
Djokovic was boosted by the later start times for his matches after the International Tennis Federation bowed to pressure from players complaining of the extreme heat and humidity at Ariake Tennis Park.
"It's great that we're playing in the afternoon hours, so we don't experience too much heat," Djokovic said.
"Although it's still very, very humid. It's a bit easier, more pleasant to play in the afternoon. It was fantastic.
"Playing after 5[pm] is completely different. Obviously, there is a little bit of a breeze, but still very, very humid, you sweat a lot, but you don't have the heat, you don't have the sun that, in combination with the humidity, is just brutal."
Japan's two standard-setters in tennis are at opposite ends of their careers, with Nishikori seemingly in a slow decline and Osaka expected to add significantly to her four grand slams.
But the focus on the Japanese public looks set to switch to Nishikori for the rest of the tennis, after he reached the last-16 stage with a 7-6 (7-5) 3-6 6-1 win over American Marcos Giron on Tuesday.
Former world number four Nishikori and Ben McLachlan are through to the doubles quarter-finals too, which may be a likelier route to a medal.
Nishikori already has a bronze to his name from the 2016 Games, where he beat Rafael Nadal in the third-place match.
When asked whether he felt expectations shifting from Osaka on to his shoulders, after she lost to Marketa Vondrousova, Nishikori said: "Not really. I just need to focus on what I have to do on the court.
"It's very sad, of course, that Naomi lost and a surprise. But I knew she had a lot of pressure, this is her first time in the Olympics and I know it's not easy.
"I didn't see her match today, so I cannot say much."
Should Nishikori, now down at 69th in the rankings, beat Ilya Ivashka of Belarus on Wednesday, that could set up a quarter-final against hot favourite Novak Djokovic.
REVENGE FOR VILLAGE FAN TSITSIPAS
It was a weary Stefanos Tsitsipas who was pummelled in the first round of Wimbledon by Frances Tiafoe last month. On Tuesday, a more predictable outcome manifested as Greece's great hope scored a 6-3 6-4 victory over his American opponent.
That loss in London came barely a fortnight after Tsitsipas suffered a heartbreaking loss to Djokovic in the French Open final, from two sets up, and he was succinct with his verdict about what was different this time.
"Concentration and attention levels," was the Tsitsipas assessment.
Next for him is a testing third-round tussle with French shot-maker Ugo Humbert, and Tsitsipas will want to hang around, having been charmed by the Olympic Village experience after so long in the tennis bubble.
"It's a different contrast, it's a different approach completely," Tsitsipas said. "I've made friendships, connected with some other athletes. It's nice to be able to experience something like this. I find the Olympics are really a nice sports event.
"I met a big tennis enthusiast from India. He's doing shooting and we became good friends. I met some of the other Greek athletes, table tennis players, and rowers from different countries."
BRILLIANT BROADY
Liam Broady was a late addition to the Olympics draw and is making the most of the opportunity, with the unheralded British left-hander scoring a terrific 7-5 3-6 6-3 second-round win over Wimbledon semi-finalist Hubert Hurkacz.
Frenchman Jeremy Chardy awaits Broady after beating Russian Olympic Committee's Aslan Karatsev in three sets.
There were also wins on Tuesday for Karatsev's countryman Karen Khachanov and Argentinian Diego Schwartzman, while Wednesday's programme features the entire third-round line-up, including Djokovic's clash with Spain's Alejandro Davidovich Fokina.
Alexander Zverev had an altogether more comfortable progression at Ariake Tennis Park, while home favourite Kei Nishikori earned an impressive upset win.
Felix Auger-Aliassime was unable to make the most of two-time defending champion Andy Murray's withdrawal, but it was a good day for Hubert Hurkacz.
Here's the pick of the action from day two of the men's singles.
TSITSIPAS OUT TO EMULATE GRANDFATHER
Greek ace Tsitsipas, a French Open finalist this year, had to dig deep for a three-set win over Philipp Kohlschreiber.
Should he manage to win gold in the Japanese capital he would be matching the feat of his grandfather, who won the football competition representing the Soviet Union in 1956.
"I've never had the opportunity to meet him. But my mom told me stories of his career and how he got it," he said. "He kind of inspires me in a way. I know what kind of athlete he was, with all the achievements and all the trophies. I'm proud of him.
"It's something good, a legacy that is being carried on in the family. I'm happy to be the next in the family to be competing at the Olympics."
ZVEREV LOVING OLYMPICS EXPERIENCE
Fourth seed Zverev coasted past Lu Yen-hsun 6-1 6-3 and spoke of how much he is enjoying being around other German athletes.
"Normally you don't have those guys around that much, you have your friends, of course you have people that are around you, but you don't sleep in the same room as them," he said.
"Yes it is very different but in a way very enjoyable. The Olympics are once every four years, and it’s five years now, so I think everybody is enjoying it and everyone is having the best time that they can."
Nishikori is playing at a fourth Olympics and upset fifth seed Andrey Rublev 6-3 6-4. For the 31-year-old the motivation is simple.
"It's [playing in Japan] something I always dreamed of when I was little," he said.
"Especially now, with the Covid situation, if I can win as many as I can, I think it will bring better news, that's something I'm trying to do this week."
AUGER-ALIASSIME FAILS TO MAKE MOST OF MURRAY ABSENCE
Auger-Aliassime was scheduled to face Murray before the Team GB star pulled out with a quad issue and will instead focus on doubles.
The Canadian was felled by Murray's replacement Max Purcell, though, the Australian winning 6-4 7-6 (7-2).
Fellow seed Gael Monfils also crashed out but Hurkacz was a 6-2 6-4 victor over Luke Saville, while Diego Schwartzman also made it through.