In a fourth-round match that finished at 01:40 (Australian time) 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 No 1 1-6, 7-5, 6-4, 6-7 (5/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 No 1 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 had his chances in the deciding set but the Serb held on and finally clinched victory with a stunning backhand pass.
Wawrinka had four chances to break at 4-4 in the fifth set but was unable to capitalise. He was unlucky on one of those points though when his ball was wrongfully called out. Replays showed it had in fact painted the line but the Swiss refrained from using the one challenge he still had at his disposal.
"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."
Results from day seven of the Australian Open:
Women's singles
Fourth round
Ekaterina Makarova (RUS x19) bt Angelique Kerber (GER x5) 7-5, 6-4
Maria Sharapova (RUS x2) bt Kirsten Flipkens (BEL) 6-1, 6-0
Li Na (CHN x6) bt Julia Goerges (GER x18) 7-6 (8/6), 6-1
Agnieszka Radwanska (POL x4) bt Ana Ivanovic (SRB x13) 6-2, 6-4
Men's singles
Fourth round
David Ferrer (ESP x4) bt Kei Nishikori (JPN x16) 6-2, 6-1, 6-4
Nicolas Almagro (ESP x10) bt Janko Tipsarevic (SRB x8) 6-2, 5-1 ret
Tomas Berdych (CZE x5) bt Kevin Anderson (RSA) 6-3, 6-2, 7-6 (15/13)
Novak Djokovic (SRB x1) bt Stanislas Wawrinka (SUI x15) 1-6, 7-5, 6-4, 6-7 (5/7), 12-10