Andy Murray saved seven match points in a 31-minute second-set tie-break before beating Philipp Kohlschreiber in the Dubai Championships quarter-finals.
The world number one needed eight set points to edge the German 20-18 in the tie-break and level the match.
No men's tour-level match has featured a tie-break with more than 38 points since 1991 - six have finished 20-18.
Murray then raced to victory in only 30 minutes in the final set to win 6-7 (4-7) 7-6 (20-18) 6-1.
The Briton, who said he had "never played a tie-break like that in my life", will face number seven seed Lucas Pouille in the last four on Friday.
The Frenchman beat Roger Federer's conqueror Evgeny Donskoy 6-4 5-7 7-6 (7-2).
Fernando Verdasco and Robin Haase will meet in the other last-four tie.
A marathon tie-break
Murray, who is playing his first tournament since his fourth-round defeat at the Australian Open in January, looked out of sorts in the first set and served two double faults as he lost the tie-break 7-4.
The 29-year-old broke early in the second and seemed to be cruising, but Kohlschreiber, who was scoring consistently with his forehand, had other ideas and broke back as the Scot served for the set.
It was the German who faltered first in the tie-break and Murray had four set points before Kohlschreiber went ahead at 9-8.
A stubborn Murray played some inspired tennis to stay in the match, including a stunning cross-court drop shot to save the first match point, while the German sent numerous groundstrokes wide on further chances to secure the match.
In the end Murray was able to capitalise on Kohlschreiber's wastefulness to level.
Kohlschreiber capitulated in the final set as Murray broke twice to race to victory in a set that lasted a minute less than the second set tie-break.
"I've never played a tie-break like that ever, not in juniors, nothing has been close to that," said Murray. "I'll probably never play another one like that again. I've been playing on the tour for 11, 12 years now and nothing, nothing's been close to that."
'It was a special match to win'
Murray lost to world number 50 Mischa Zverev at the Australian Open having been beaten by Novak Djokovic in the final of the Qatar Open at the beginning of January.
The three-time Grand Slam winner said the manner of his victory over Kohlschreiber would give him "a lot of confidence".
He said: "They can be very important matches to get through. I could have easily lost tonight, but the way I played when I was behind will give me a lot of confidence after what was a tough start to the year. I want to keep that going now, it was a special match to win because of how it went."
In a tie-break players must change ends every six points, but Murray, Kohlschreiber and the umpire forgot to do so at 15-15.
Murray added: "I realised at 16-16, the umpire said he forgot and the machine didn't recognise it, I do not know if the machines are made to go that high, it doesn't happen every often."
Kohlschreiber said: "Of course losing is always disappointing, but I'm not sad. I think I played great tennis, one of my best matches. You can be thinking about one or two shots, but it was just a great match. It's well-deserved, he's a great fighter, he never gave up."