Novak Djokovic strolled out of Rod Laver Arena a little after midnight, the cheers – and a few jeers – behind him drifting into the cool night through the opened roof. As he headed for the refuge of the locker room, he cuddled the heavy silver Norman Brookes trophy as if it were a baby, a prize he ought to own in perpetuity.

Then he paused for several minutes in a corridor and shared the moment with his brother, Djordje, his agents, his trainer and the two men who have had a significant influence on his tennis, Goran Ivanisevic and Marian Vajda.

Novak Djokovic v Dominic Thiem goes to deciding set: Australian Open final – live! Read more

They laughed long and loudly. Djokovic, his bauble at his feet, doubled up, slapping his knees at someone’s remark. They might have been at a party in Belgrade, or back at his vegan restaurant in Monte Carlo. He is a citizen of the world, and wherever he hangs his trophies, that’s his home.

Djokovic owns Melbourne, and has shares in Wimbledon, Roland Garros and Flushing Meadows: 17 majors now, closing fast on Rafael Nadal (19) and Roger Federer (20). The nearest active players to them in slam titles are Andy Murray and Stan Wawrinka, with three apiece, and they are not contenders lately. The real threat comes from further away.

So Djokovic had every reason to celebrate with his closest friends. His status, returned to No 1 in the world, and his future are safe. Yet only a couple of hours earlier, he looked as helpless as a lost child, drained of energy and clueless as to how to solve the riddle of Dominic Thiem, six years his junior and, for at least half of their final, his equal.

Djokovic took almost four hours to win 6-4, 4-6, 2-6, 6-3, 6-4 in defence of his favourite title in his favourite city, but he came desperately close to being booed out of the championship by a small section of the crowd who turned on him at the very moment he needed friends the most. As his tennis disintegrated, he yelled at them: “Shut the fuck up!”

Then, in the ninth game of the second set, Djokovic had a meltdown like no other in his career, and it did not pass quickly. He double-faulted to go 15-30 down. The chair umpire Damien Dumusois gave him a time violation for slow serving. He made a mess of a drop shot. He dawdled to the service line. To his amazement, he lost his first serve to another time violation for 15-40, and his temper after driving a forehand long.

When he passed the umpire’s chair, he tapped Dumusois’s shoe and let him know what he thought of him: “Great job man, especially the second one. You’ve made yourself famous. Well done.”

His head was all over the place. The fire inside threatened to undermine him. Then, ever so slowly, he recovered. He fought his way back into the contest, like a bruised old heavyweight coming off the ropes.

Thiem was just as determined but could not hold the reinvigorated Djokovic at bay.

Djokovic had started the evening with two aces in two minutes, then hit three in the next three hours. Now, serving for the title, he found a ninth. They embraced at the net. Djokovic shook the umpire’s hand. Time to leave the trauma behind – although there will be versions of this yet to come.

Facebook Twitter Pinterest Novak Djokovic consoles Dominic Thiem after a memorable final. Photograph: Francis Malasig/EPA

“I was on the brink of losing that match,” Djokovic said later. “I didn’t feel great at all. Dominic was dominating from the back of the court and won two sets easily. I had to play all or nothing, serve and volley, to get the energy back.

“I didn’t have any injuries. It was very strange. My energy completely collapsed. Every time I tossed the ball up I would feel dizzy. From two all in the fourth I started to feel better. I can’t really explain it at the moment. The doctor told me as we walked off the court that I had maybe a few conditions, that I was dehydrated.

“But there was definitely an emotional aspect to all of this. I was nervous, stressing out about everything around me. I couldn’t believe what was happening. There was a point when I said to myself, I just have to accept it.”

He said that, at 32, he wants to spend more quality time with his wife, Jelena, and their two young children, Stefan and Tara, and he would adjust his schedule accordingly. “I am not just a tennis player, I am a father and a husband. I will probably have to play less to stay in my prime, and not travel the whole year. It is my ambition to win as many of the grand slam titles as I can. It’s professionally what matters most to me.”

Certainly, he would not want to endure many more nights like Sunday evening. It was weird to witness, almost embarrassing; it must have been equally strange for Thiem to experience.

Serves, sunsets and koalas: Australian Open 2020 – the tournament's best photos Read more

The Austrian, who will surely break through soon after falling in his third slam final, said later: “There were some small mistakes here and there, but they happen. At the end, it was a super-close five-setter. I don’t really regret anything.

“These guys [Djokovic, Nadal and Federer] have brought tennis to a completely new level. They also brought me probably to a much better level. I hope that I win my maiden slam when they’re still around, because it will just count more.”