The 115th-ranked Kyrgios worked up the crowd, hit 'tweeners and drop shots, mixed up the pace of his groundstrokes and tossed in an under-arm serve in a bid to ruffle the second-ranked Russian.
Medvedev kept his composure, taking a quick trip to the locker room after losing the third set and recovering to win 7-6 (1), 6-4, 4-6, 6-2 Thursday on a rowdy Rod Laver Arena.
In an on-court TV interview with former champion Jim Courier, Medvedev was asked how he managed to stay so composed.
``That's the only choice when you get booed between first and second serve,'' he said, triggering some boos from the crowd. ``It's not easy. The (service) games I lost, on the break points, it was the case. It's tough to play.``
Kyrgios usually likes to play on John Cain Arena, known locally as the People's Court because fans with ground passes can get in and the singing and chanting is always less restrained than the two main show courts.
He managed to turn the all-ticketed stadium court into something more akin to a soccer stadium.
In the seventh game of the third set, Kyrgios got two break-point chances when he bunted away a backhand from Medvedev directed at his body and then took off on a circular run behind the baseline to celebrate like he had scored a goal.
When he converted the break, he danced in the change-over and worked up the crowd. Medvedev managed to lower the volume with two service breaks in the fourth set.
It was Medvedev's first win over Kyrgios following two losses in 2019.
And there were cheers later when Courier suggested a new crowd favorite for the rest of the tournament.
Medvedev was the runner-up last year but avenged that loss by beating Novak Djokovic in the U.S. Open final.
He's the quasi No. 1 now, anyway, because Djokovic was deported on the eve of the tournament for failing to meet Australia's strict COVID-19 vaccination regulations.
Another contender in his half of the draw had a more routine run to the third round, with fourth-seeded Stefanos Tsitsipas beating Sebastian Baez 7-6 (1), 6-7 (5), 6-3, 6-4 in a match featuring two former top-ranked junior players.
Five-time runner-up Andy Murray only lasted two rounds. Two days after winning his first match at the Australian Open in five years, the former No. 1 lost to 120th-ranked Taro Daniel 6-4, 6-4, 6-4.
Other winners among the men included No. 5 Andrey Rublev, No. 15 Roberto Bautista Agut, No. 20 Taylor Fritz, 2014 U.S. Open champion Marin Cilic and No. 32 Alex de Minaur. No. 24 Dan Evans moved on when the player he was supposed to face in the second round, Arthur Rinderknech, pulled out with an injured wrist.
Australian wild-card entry Chris O'Connell upset 13th-seeded Diego Schwartzman 7-6 (6), 6-4, 6-4.
There were surprises in the women's draw on Day 4, with No. 3 Garbine Muguruza becoming the highest-seeded player to exit only minutes after No. 6 Anett Kontaveit lost.
U.S. Open champion Emma Raducanu lost to Danka Kovinic 6-4, 4-6, 6-3.
Second-seeded Aryna Sabalenka served a nine double-faults in her first two service games, 12 in the first set and appeared to be on the brink of a second-round defeat before recovering to hold off 100th-ranked Wang Xinyu 1-6, 6-4, 6-2.
She will next face 31st-seeded Marketa Vondrousova, the 2019 runner-up at Roland Garros who beat Liudmila Samsonova 6-2, 7-5.
Kontaveit, the runner-up at the WTA Finals, lost to 19-year-old Clara Tauson 6-2, 6-3. Tauson will make her debut in the third round at a major against 2019 Australian Open semifinalist Danielle Collins.
No. 7 Iga Swiatek, the 2020 French Open champion, No. 19 Elise Mertens and Sorana Cirstea were among the other women advancing. Zhang Shuai of China moved into the third round when No. 12 Elena Rybakina retired from their match while trailing 6-4, 1-0.
Sam Stosur's 6-2, 6-2 loss to No. 10 Anastasia Pavlyuchenkova ended the 2011 U.S. Open champion's 20th, and last, singles campaign at the Australian Open.
Muguruza never managed to earn a single break point and made 33 unforced errors, more than twice her opponent's total, in a 6-3, 6-3 loss to Alize Cornet.
``A little bit surprised about my level. I am a little disappointed, too,'' said Muguruza, a two-time major champion and 2020 Australian Open runner-up who won last year's season-ending WTA Finals.
And the 61st-ranked Cornet? She's appearing in her 63rd career major tournament _ and 60th in a row _ but never has been beyond the fourth round.
Cornet will get a chance to equal that showing when she plays Tamara Zidansek on Saturday, her 32nd birthday.
She called herself ``a little bit (of) a dinosaur.''
``I don't know how many years I have left,'' Cornet said. ``Today was a perfect gift I could give myself and I really hope the journey's going to go even farther for me.''