The 38-year-old closed out the first set easily before a slight wobble in the second when she was broken twice by Gasparyan, before progressing into the third round.
For Williams, a relentless perfectionist, the meeting is yet another chance for self-improvement. The Czech was stunned in straight sets by France's world number 50 Caroline Garcia.
In the first two sets, Thiem clinched 18 winners, committed just four unforced errors and broke serve four times on seven occasions.
The 38-year-old had last won a Grand Slam in 2017 as she had emerged triumphant in the Australian Open.
"It was intense", Williams said after the match.
Second seed Dominic Thiem continued his magnificent run, beating Marin Cilic 6-2, 6-2, 3-6, 6-3 at the Arthur Ashe Stadium. Serena is one of the best servers in history and it wasn't easy to read her initial shot.
At this stage in her life, Williams is discovering the key to success lies in finding room to allow for the occasional botched letter.
Cornet is making her 57th Grand Slam appearance, and her 54th in a row.
Stephens, the 2017 Open champion who was once ranked as high as No. 3, was sensational in the opening set, dictating play and moving Williams around like a chess piece.
"He's one of the big champions of the last decade, Thiem said of Cilic". It's like I have got to get rid of this guy.
Elsewhere on Saturday, 2019 runner-up Daniil Medvedev posted a 6-3, 6-3, 6-2 victory over American wild-card entry J.J. Wolf.
British ninth seed Jo Konta became another high-ranking woman to be sent packing, losing in three sets to Romania's Sorana Cirstea after going a set ahead.
Williams' next challenge comes in the round of 16 on Labor Day, when her opponent will be Greece's Maria Sakkari, the No. 15 seed, who smoked American teenager Amanda Anisimova, 6-3, 6-1 in 55 minutes.