The first two scoring tosses from Romo erased seven-point deficits, including a 23-yarder to Dez Bryant that was vintage Romo and broke Aikman's career mark of 165 TD passes. Romo scrambled to his right and threw back across the field to Bryant, who weaved through the Philadelphia defense to tie it at 17 in the third quarter.
Romo tied it again at 24 on a throw to Miles Austin, and had one more answer after Brown and Foles led the Eagles to a go-ahead field goal. He threw deep to Bryant for 35 yards on third down, and Bryant found his way into the end zone again by taking a screen pass 6 yards just inside the pylon for a 31-27 lead with 5:40 remaining in the game.
"It's about winning games," said Romo, who was 10 of 10 in the second half and completed his last 12 passes. "We desperately had to have this win tonight, and our team fought like heck to get a win."
The Eagles' slide continued despite 169 yards rushing and two touchdowns from Brown a week after he set a team rookie record with 178 yards on the ground.
After Romo's go-ahead touchdown pass, Dallas went up by 11 when Morris Claiborne returned a fumble by Brown 50 yards for a touchdown.
Brown's fumble snapped a streak of eight straight scoring drives by both teams. It was the second straight week that he mixed big runs with critical fumbles after losing the ball twice in last week's loss to Carolina.
"It was a tough loss," Foles said. "I'm proud of our team with the way they fought. We have to keep working and stick together."
Dallas running back DeMarco Murray, who started after missing six games with a sprained right foot, finished with 83 yards and a touchdown. Romo was 22 of 27 for 303 yards with no interceptions and a passer rating of 150.5.
Brown, who started his first game since high school when he filled in for LeSean McCoy last week, went in untouched on both of his scoring plays in the first half. He scooted around the left side for a 7-0 lead and trotted through a big hole up the middle to make it 14-3 midway through the second quarter.
Vick and McCoy are sidelined by concussions.
Brown got Philadelphia's first scoring drive going with a 42-yard run up the middle and finished it with a 10-yard run.
Trailing 7-3 early the second quarter, the Cowboys went three and out after a third-down completion from Romo to Witten was overturned on a challenge by Reid. Replay showed the ball hitting the turf as Witten grabbed it.
Two plays later, Brown went 39 yards down the sideline and later scored from 5 yards out.
NOTES: The Cowboys snapped an eight-game losing streak on Sunday night. ... Foles' first two career TD passes were against Dallas, and both were to Riley Cooper. ... Heisman Trophy contender Johnny Manziel of Texas A&M watched the game from a suite. His next game will be at Cowboys Stadium, against Oklahoma in the Cotton Bowl on Jan. 4.
Copyright 2012 by The Associated Press