Nick Mullens threw a 7-yard TD pass to Richie James Jr. with 18 seconds left to cap the comeback. Jeremy McNichols scored on a 1-yard run with 4:24 to go for San Francisco.
San Francisco's Jimmy Garoppolo didn't fare as well as Prescott in his first game action since signing a $137.5 million, five-year contract this offseason. Garoppolo completed 3 of 6 passes on his one drive.
More concerning for the 49ers was the fact that five players left with injuries in the first 16 minutes of the game, including defensive starters Malcolm Smith and Solomon Thomas.
Prescott sat out the first exhibition game last season but got one series of action against the 49ers this year and looked sharp. He completed all three of pass attempts and converted a third-and-9 with a 12-yard scramble.
He capped his night with the deep ball to Gallup, who beat Jimmie Ward down the sideline. Ward got the start at cornerback in place of Richard Sherman, who is nursing a hamstring injury.
With the release of three-time Pro Bowl receiver Dez Bryant and the retirement of 15-year tight end Jason Witten, the Cowboys are searching for receiving threats this preseason. Gallup, a third-round pick out of Colorado State, has been impressive so far in camp.
No players on either team kneeled during the national anthem, although 49ers receiver Marquise Goodwin did raise his right fist throughout the song. The Niners have been at the center of the protests during national anthem ever since Colin Kaepernick began kneeling two years ago. Eric Reid protested last year but both players are no longer with the team. Linebacker Eli Harrold also kneeled during the anthem the past two years but stood to start this season.
The Niners had a parade of injuries early, starting with Smith limping off with a hamstring issue on the opening drive. TE George Kittle and backup RB Matt Breida left with shoulder injuries. Thomas and backup tackle Garry Gilliam were sidelined by head injuries.
Cowboys OL Marcus Martin limped off the field in the second half with a toe injury, S Marqueston Huff left with a groin injury, and WR Marchie Murdock had an ankle injury.
Joe Thomas got the start at linebacker for Dallas in place of Sean Lee and delivered an interception against C.J. Beathard on a tipped pass by Kavon Frazier. ... Cowboys rookie RB Bo Scarbrough had a 28-yard run and scored a 1-yard TD in the second quarter. ... James had four catches for 46 yards and fellow rookie Dante Pettis caught a 53-yard pass .
There was one penalty under the new rule prohibiting players from leading with their helmets. San Francisco LB Elijah Lee was called for the infraction on a tackle against Scarbrough in the third quarter.
Cowboys: Host Cincinnati on Aug. 18.
49ers: Visit Houston on Aug. 18.
More AP NFL: https://apnews.com/tag/NFLfootball and https://twitter.com/AP-NFL