The six-time winner struggled for rhythm and lost 7-6 (10-8) 5-7 2-6 7-6 (7-5) 6-4 in four hours and 48 minutes.
It is the first time Djokovic, 29, has lost in the second round of a Grand Slam since 2008 at Wimbledon.
The result leaves world number one Andy Murray as favourite to win his first Australian Open title in Melbourne.
Britain's Murray, who has already reached round three, has lost five finals in the past seven years in Melbourne, four of them to Djokovic.
It is only the second time in seven years that Djokovic has lost to a player ranked outside the top 100 - his defeat by Juan Martin del Potro, ranked 145th, at the Rio Olympics in 2016 being the other occasion.
"He deserved to win. No doubt, he was a better player in the clutch moments," Djokovic said.
"Many things came together for him today and he's a well-deserved winner. There's not much I could do."
Djokovic could not find his rhythm, eventually winning his first service game after 15 minutes but going on to lose the first set in one hour and 25 minutes.
He won four consecutive games in the third set as his opponent faltered but Istomin came back in the fourth set to take it to a tie-break.
Both players served aggressively as they received vocal support from the crowd, with Istomin taking the match to a deciding set with a brutal ace.
Istomin, who broke in game five, remained strong on his own serve and raised his arms to the crowd after Djokovic sliced his final shot into the net.
Uzbek Istomin will next face Spain's Pablo Carreno Busta, who beat Britain's Kyle Edmund on Thursday.
"It is the biggest win [of my career] for me and means so much, now I feel I can play with these guys and be with them on the same level," said Istomin.
"From the third set I had cramp in my leg, I don't know how I held it. I was playing so good. I surprised myself."
Istomin had two years out of the game after breaking his leg in a car accident in 2001 and spending three months in hospital.
Coached by his mother Klaudiya, he dropped out of the top 100 in 2016 and was given a wildcard to play in the Australian Open.
Prior to his win over Djokovic, Istomin had won just one of 33 matches against a player ranked in the world's top 10.
His best Grand Slam result is reaching the last 16 at Wimbledon in 2012 and the US Open in 2013, where he lost to Murray.
Djokovic has struggled for consistency since winning his first French Open title in June 2016 and completing a career Grand Slam.
He was knocked out in the third round at Wimbledon by American Sam Querrey but looked to have returned to form when he won the Rogers Cup in July.
However, he went on to lose to Del Potro in the first round of the Olympics and was knocked out of the doubles competition the following day.
He struggled physically in the US Open final, losing in four sets to third seed Stan Wawrinka, before he lost the world number one ranking to Murray in November.
Murray also ended his run of four consecutive ATP World Tours Finals titlesin the same month.
"Djokovic is not the same Djokovic we saw this time last year, who was at the peak of his career," two-time Australian Open finalist Pat Cash told BBC Radio 5 live.
"It's clearly the mental edge. He's done so much and worked so hard to grab those four Grand Slams, I think he's just lost the edge."