Grimacing through gritted teeth, a weary Grigor Dimitrov withstood leg cramps, crashes to the court, lost opportunities, and the stubborn surge of world No. 1 Novak Djokovic.

Through it all, the 21-year-old never lost his appetite for the fight.

Persevering through a punishing physical test, Dimitrov fought off three set points in the first set, battled leg cramps in the second set, and broke in the opening game of the third set to stun Djokovic, 7-6 (6), 6-7 (8), 6-3, in a wild thriller that left Dimitrov pinching back tears when it finally ended after 11 p.m. local time.

The match spanned three hours and four minutes, and if Dimitrov fulfills his prodigious potential, he may well look back on this night as the moment he came of age. The back of his grey-green Nike shirt was streaked with a swath of red clay from a first-set fall to the court, dried blood splotched his legs from couple of cuts near his knees, and his left leg occasionally shook with spasms.

The top seed fought through his own issues: Djokovic rolled his right ankle and took a nine-minute injury timeout for treatment midway through the second set, and battled both a boisterous crowd chanting Dimitrov’s name and the young Bulgarian’s unsettling skill for sticking shots right on the lines in critical spots.

The 28th-ranked Dimitrov took a set from Rafael Nadal in Monte Carlo last month, but stats reinforced Djokovic’s expansive advantage in experience: Nole took the court with 14 career Masters titles; Dimitrov arrived on court with 14 Masters match wins. But a surprisingly sloppy start to the seventh game saw Djokovic commit three straight errors to face triple break point. He saved the first with an ace, won a 20-shot rally to erase the second, and fought off the third with a backhand down the line that sent Dimitrov crashing to the clay in pursuit.

“You OK?” Djokovic asked his fallen opponent. Dimitrov responded with a thumbs up. Even when knocked down, Dimitrov was still looking up.

A sharp Djokovic cross-court backhand drew an error to give him set point on Dimitrov’s serve in the 10th game. Dimitrov attacked the net and blocked back a volley that Djokovic could have struck, but the Serbian made a poor decision in stopping play, believing the shot landed long. Chair umpire Carlos Bernardes inspected the mark, ruled the shot good, and Dimitrov eventually held. He then broke Djokovic at 30 for a 6-5 lead, only to see Djokovic break right back and force a tiebreaker.

A penetrating cross-court forehand gave Djokovic a 4-1 lead that eventually extended to 6-4. Staring down a second set point, Dimitrov laced an ace down the middle that caught the line, and when Djokovic sprayed an inside-out forehand wide, Dimitrov erased the second set point. Punctuating a tremendous running forehand winner down the line with a fist pump and a “Come on!”, Dimitrov earned his first set point. When Djokovic blocked a backhand return into net, Dimitrov had snatched the 65-minute first set that seemed firmly locked in Djokovic's grasp minutes earlier.

Trailing 2-4 in the second set, Djokovic rolled over his right ankle—the same ankle he sprained against Sam Querrey in last month’s Davis Cup match in Boise—immediately dropped his racquet, and stopped play, leaning against the flower bed behind the baseline for support in pain. Djokovic took an extended injury timeout to have his ankle re-taped, and shortly after play resumed he broke back for 3-4 as both men raised the physical stakes. Deadlocked at 5-all, deuce, Dimitrov cramped up, clutched his left leg in the midst of a point, and stopped play. Djokovic had a clean shot at a mid-court forehand sitter, but sailed it long as Dimitrov eventually held—though it appeared cramps would cripple his hopes.

Fans erupted in a rousing chant of “De-Me-Trov! De-Me-Trov!” in an effort to urge the underdog over the finish line in the tiebreaker. It helped, as he reached match point, but Djokovic unleashed a surprise serve-and-volley play and drew a return error to even the score at 8-all. On his third set point, Djokovic converted when Dimitrov netted a forehand; he jutted his chin forward and pumped his fist at seizing the 84-minute second set.

A fired-up Djokovic had the momentum, but Dimitrov took it right back, breaking to open the third set and fighting off break points to consolidate for 2-0. A defiant Dimitrov, who finished with 13 aces and saved 10 of 12 break points, made that break stand up. When Djokovic scattered a forehand wide, the pair engaged in a respectful embrace at net before Dimitrov, chomping on his towel and fighting back tears, celebrated a hard-fought triumph with his support team that included former French Open finalist Magnus Norman.