French Open champion and Wimbledon finalist Zverev, handed top billing in New York in the absence of injured world No.1 Jannik Sinner, was taken the distance by Sonego before progressing with a 6-4 3-6 6-7 (7-9) 7-5 6-4 win.
"He is an amazing tennis player," Zverev told reporters after the four-hour, 53-minute battle.
"He has an amazing serve and forehand and he can return so quickly."
The German was two points from defeat at one stage but kept his composure when it mattered to set up a clash with Quentin Halys of France.
"I would say I have one of the fastest second serves on tour and he was attacking it all the time," Zverev added.
"I have to give credit to him, but I'm happy I managed to win in the end.
"Overall, it was a great battle and a match that I needed after the last couple of weeks."
Earlier on Tuesday (Wednesday AEST), also inside Arthur Ashe Stadium, American Taylor Fritz harnessed his mighty serve to roll into the second round, beating compatriot Darwin Blanch 6-3 6-2 6-4.
A finalist in 2024, ninth-seed Fritz looked right at home against the 18-year-old wildcard, hitting 14 aces to set up a meeting with Mattia Bellucci of Italy, who downed Hungarian Zsombor Piros in straight sets.
"It's never easy to come out and play another young American," said Fritz, who had a withering appraisal of his own return game.
Fritz dropped only one first-serve point in the opening set and got the break in the sixth game and wore down Blanch's defences in the second, converting on his fourth break point in the fifth game and again in the seventh.
Blanch let another shot go past the baseline on break point in the opening game of the third set and Fritz slammed his foot on the gas from there, extinguishing the only two break points he faced in the second game with an ace and a punishing backhand.
He sealed it with an unreturnable serve, giving the home fans more reason to cheer after compatriots Frances Tiafoe and Ben Shelton both won during Monday's night session.
On Louis Armstrong, fifth seed Flavio Cobolli came back from two sets down to beat Argentina's Francisco Comesana 3-6 2-6 6-3 6-4 6-4.
Lorenzo Musetti then recorded a comprehensive 6-3 6-3 7-5 defeat of Briton Arthur Fery, who made a surprise run to the Wimbledon semi-finals, while French showman Gael Monfils celebrated his 40th birthday with a 2-6 6-1 6-2 6-0 win over Adolfo Daniel Vallejo to keep his farewell grand slam campaign alive.