World number one Osaka, bidding to add the French Open to her US and Australian Open titles, came back from a set and 2-4 down to defeat former world number one Victoria Azarenka 4-6, 7-5, 6-3.
Her win came on the back of being just two points from defeat in her tournament opener against Anna Karolina Schmiedlova.
The 21-year-old held her nerve, despite squandering two match points late in the deciding set, to secure her place in the third round and a clash against Katerina Siniakova of the Czech Republic.
"I was lucky to have played Victoria twice before. I knew she had been playing well coming into the tournament," said Osaka.
"It was an unfortunate second round draw for me so I am happy to win."
Osaka finished the two-hour 50-minute encounter on Court Suzanne Lenglen with 52 winners and 43 unforced errors.
She becomes the first top seed to win her two opening matches at Roland Garros after losing the first set since Lindsay Davenport in 2005.
"I didn't push enough through so I have to learn from that but I have to take positives from the match," said 29-year-old Azarenka.
"She deserves to be where she is -- she is very powerful and explosive."
Siniakova, the world number 42, also endured a marathon win, putting out Greek 29th seed Maria Sakkari 7-6 (7/5), 6-7 (8/10), 6-3 in a three-hour 10-minute duel.
Siniakova had trailed 1-5 in the first set before surrendering a 5/2 lead in the second-set tiebreaker.
Thiem overcame an entertaining challenge from Kazakhstan's Alexander Bublik to reach the third round for the fourth straight year.
The Austrian fourth seed was facing a fifth set when trailing 5-2 in the fourth, but reeled off five straight games to win 6-3, 6-7 (6/8), 6-3, 7-5.
World number 91 Bublik delighted the Court Philippe Chatrier crowd with his wide range of shots, including an underarm serve in the opening set, but eventually ran out of steam.
The reward for Thiem is a clash against Uruguay's Pablo Cuevas who made it through when British number one Kyle Edmund retired with a knee injury at 7-6 (7/3), 6-3, 2-1 down.
Amanda Anisimova became the youngest American woman since Serena Williams in 1999 to make the third round when the 17-year-old defeated Belarus' 11th seed Aryna Sabalenka 6-4, 6-2.
Fellow 17-year-old Iga Swiatek of Poland also reached the last 32, seeing off Chinese 16th seed Wang Qiang.
Later Thursday, Novak Djokovic continues his bid to become only the second man to hold all four Slams simultaneously for a second time when he faces Swiss lucky loser Henri Laaksonen, the world 104.
Three-time champion Serena Williams looked rusty in her opener against Vitalia Diatchenko where she dropped the first set.
The American, who is attempting to equal Margaret Court's all-time record of 24 Grand Slam titles, racked up her 800th career main draw win in a match which saw her unveil her 'mother, champion, queen, goddess' logo on her playing gear.
On Thursday, she faces world number 238 Kurumi Nara who stands just 5ft 1in (1.55m).
Results from the fifth day of the French Open on Thursday (x denotes seeding):
Novak Djokovic (SRB x1) bt Henri Laaksonen (SUI) 6-1, 6-4, 6-3
Salvatore Caruso (ITA) bt Gilles Simon (FRA x26) 6-1, 6-2, 6-4
Jan-Lennard Struff (GER) bt Radu Albot (MDA) 7-6 (7/2), 7-6 (7/3), 6-7 (4/7), 6-2
Borna Coric (CRO x13) bt Lloyd Harris (RSA) 6-2, 6-3, 7-6 (7/2)
Fabio Fognini (ITA x9) bt Federico Del Bonis (ARG) 6-4, 3-6, 6-3, 6-3
Roberto Bautista Agut (ESP x18) bt Taylor Fritz (USA) 6-2, 6-3, 6-2
Dusan Lajovic (SRB x30) bt Elliot Benchetrit (FRA) 6-3, 6-3, 6-4
Alexander Zverev (GER x5) bt Mikael Ymer (SWE) 6-1, 6-3, 7-6 (7/3)
Dominic Thiem (AUT x4) bt Alexander Bublik (KAZ) 6-3, 6-7 (6/8), 6-3, 7-5
Pablo Cuevas (URU) bt Kyle Edmund (GBR x28) 7-6 (7/3), 6-3, 2-1 - retired
Antoine Hoang (FRA) bt Fernando Verdasco (ESP x23) 6-4, 3-6, 7-6 (7/5), 7-5
Gael Monfils (FRA x14) bt Adrian Mannarino (FRA) 6-3, 6-4, 6-4
Karen Khachanov (RUS x10) bt Grégoire Barrère (FRA) 6-3, 7-6 (8/6), 0-6, 7-5
Jordan Thompson (AUS) bt Ivo Karlovic (CRO) 6-3, 6-4, 6-7 (2/7), 6-3
Juan Martín Del Potro (ARG x8) bt Yoshihito Nishioka (JPN) 5-7, 6-4, 6-2, 6-7 (5/7), 6-2
Leonardo Mayer (ARG) bt Diego Schwartzman (ARG x17) 4-6, 6-3, 6-4, 7-5
Naomi Osaka (JPN x1) bt Victoria Azarenka (BLR) 4-6, 7-5, 6-3
Katerina Siniaková (CZE) bt Maria Sakkari (GRE x29) 7-6 (7/5), 6-7 (8/10), 6-3
Anna Blinkova (RUS) bt Caroline Garcia (FRA x24) 1-6, 6-4, 6-4
Serena Williams (USA x10) bt Kurumi Nara (JPN) 6-3, 6-2
Andrea Petkovic (GER) bt Su-Wei Hsieh (TPE x25) 4-6, 6-3, 8-6
Ashleigh Barty (AUS x8) bt Danielle Collins (USA) 7-5, 6-1
Simona Halep (ROM x3) bt Magda Linette (POL) 6-4, 5-7, 6-3
Mónica Puig (PUR) bt Darya Kasatkina (RUS x21) 6-3, 6-1
Iga Swiatek (POL) bt Wang Qiang (CHN x16) 6-3, 6-0
Amanda Anisimova (USA) bt Aryna Sabalenka (BLR x11) 6-4, 6-2
Irina-Camelia Begu (ROM) bt Karolína Muchová (CZE) 1-6, 6-3, 6-4
Ekaterina Alexandrova (RUS) bt Samantha Stosur (AUS) 3-6, 6-1, 6-4
Aliona Bolsova (ESP) bt Sorana Cirstea (ROM) 7-6 (7/5), 7-6 (7/3)
Belinda Bencic (SUI x15) bt Laura Siegemund (GER) 4-6, 6-4, 6-4