In a fourth-round match that finished at 1.40am local time, the Swiss, who took an early 6-1, 5-2 lead and had chances to gain a break in the fifth set, was eventually beaten by the world number one 1-6 7-5 6-4 6-7 12-10 after five hours and two minutes.
"I think it's by far the best match I ever played, especially in five sets against the number one player," 15th-seed Wawrinka told reporters, wiping away tears.
"At the end I was really, really close, so for sure I'm really sad. But I think there is more positive than negative.
"At the end he was still there. He was playing great tennis. We were both tired, but I really fought like a dog."
Wawrinka had outplayed Djokovic for the first hour and in the deciding set had four break point chances at 4-4 but the Serb held on and finally clinched victory with a stunning backhand pass.
"For sure I was serving for the second set to be up two sets to love, but in five sets, five hours, you always have some opportunity to win a set or to win the match," Wawrinka said.
"If you don't take it, he's going to take it."
Despite the defeat, Wawrinka believed the way he had played against Djokovic could spur him on to bigger and better things.
"I think I can use it, I hope I will use it," he said. "I think it's important if I want to keep improving myself, my game, to try to come back closer to the top 10."