Gauff double-faulted twice in the last game of the 2-hour, 11-minute match.
Gauff, 16, has reached at least the third round at the other three major tournaments.
For Trevisan, a 26-year-old from Italy, this was her first victory in a Grand Slam match played to its conclusion.
Trevisan lost in the first round at the Australian Open this year in her first appearance at a major, then advanced Sunday at Roland Garros when her opponent, Camila Giorgi, retired in the second set because of an injury.
Against Gauff, Trevisan kept yelling, "Yes!" and "Let's go!" in Italian between points, then let out a high-pitched scream when the match ended.
Azarenka's exit means all four women who reached the semifinals in New York earlier this month already are gone in Paris.
Serena Williams withdrew from the French Open because of an injured Achilles tendon, Jennifer Brady lost in the first round at Roland Garros, and US Open champion Naomi Osaka did not make the trip to France.
Schmiedlova had lost 13 consecutive Grand Slam matches in a streak dating to 2015 until beating Venus Williams in the first round this week.
Azarenka is a former No. 1 and a two-time champion at the Australian Open.
Apparently struggling with cramps, the fifth-seeded Bertens was treated by a trainer both during and after the 3 hour, 11 minute match.
Afterward, Errani accused Bertens of faking her pain.
Bertens saved a match point with a forehand cross-court winner when Errani served for the match at 6-5 in the third.
Struggling with her ball toss, Errani often resorted to underhand serves. She had 14 double-faults.
Svitolina's match was one of the few interrupted by a sonic boom caused by a fighter plane breaking the sound barrier.
Before the cause of the loud bang was known, there was a brief moment of panic outside the grounds of Roland Garros in western Paris as police officers gave instructions to cordon off the area with the possibility of evacuating people. A few security officials sprinted down Boulevard d'Auteuil -- a long road leading to one of the main entry gates -- shouting into two-way radios.
A few minutes later, however, police revealed the cause and officials on the grounds were told of the "false alert."
"I was a bit worried because I thought something bad happened. I looked at the chair umpire, he was little bit shocked as well," Svitolina said after her match. "You never know these days what can happen, what's going on. It was very strange, very loud, like something big dropped."
The Associated Press contributed to this report.