SANTA CLARA, Calif. — An off-balance Colin Kaepernick improvised, threw across his body and across the field, finding Frank Gore open near the opposite sideline more than 20 yards away.
Gore bailed out a broken play and helped get the San Francisco 49ers back on track with a big day.
He caught that career-best 55-yard touchdown pass and ran for 119 yards in his first 100-yard game of 2014, leading San Francisco past Philadelphia 26-21 on Sunday to hand the Eagles their first loss.
"I don't think I've ever had one quite like that," Kaepernick said. "It was a great job by Frank."
"Great job by Kap," Gore offered, standing next to his quarterback on the postgame podium.
It was the longest TD catch by a running back this season.
Coach Jim Harbaugh didn't see Gore open and had no idea where Kaepernick was going on that play.
"Kap did a great job keeping his eyes up field. I had no idea. When he stopped, pulled it up and started to throw, I didn't know where he was going with the ball," Harbaugh said. "The speed, the angle, the way he got into the end zone was something. I didn't think he was going to get it in."
Regardless, the 49ers got Gore involved in the offense again, and it returned them to their winning ways. Hard-nosed defense helped, too.
The 49ers (2-2) avoided their first three-game losing streak under Harbaugh, containing the league's top passer.
Nick Foles threw two incomplete passes from the 1 in the waning moments after gaining six first downs on a lengthy drive, more than the five the Eagles managed before that.
"We just didn't execute, it's as simple as that," Foles said. "I'm not going to break it down or anything."
Foles (195 yards) missed a chance to join Peyton Manning, Steve Young, Kurt Warner and Drew Brees as the only QBs to open the season with four straight 300-yard passing games.
On a day the 49ers gave up big plays on special teams, Gore delivered. He had a 28-yard run on a drive that led to Phil Dawson's go-ahead, 46-yard field goal in the third quarter. Kaepernick also threw a touchdown pass to Stevie Johnson and Dawson kicked four field goals. Kaepernick finished 17 for 30 for 218 yards and two TDs. He absorbed four sacks.
Darren Sproles had a career-best 82-yard punt return for a touchdown and Malcolm Jenkins returned an interception 53 yards for a score for the Eagles (3-1). Brad Smith recovered Trey Burton's blocked punt for a TD.
The 49ers produced in the second half for the first time this season to give Harbaugh a win against former Pac-10 foe Chip Kelly.
Antoine Bethea intercepted his first pass with the 49ers and forced a fumble, then the secondary kept the pressure on in the red zone. Perrish Cox made an interception with 41 seconds left to seal it.
The 49ers won their first game at new Levi's Stadium, where thousands of fans skipped out at halftime.
San Francisco tight end Vernon Davis was sidelined with a back injury early in the third quarter and he was still experiencing spasms after the game, though an X-ray was negative. Davis missed last Sunday's loss at Arizona with a left ankle injury.
Teddy Bridgewater's first NFL start ended early.
The Minnesota rookie passed for 317 yards and a key 2-point conversion before hurting his ankle in the fourth quarter of a 41-28 win over Atlanta on Sunday.
Bridgewater was 19 for 30 with no turnovers and ran five times for 27 yards and a score, but his last carry was costly. His left foot rolled underneath him as he was sandwiched by two tacklers at the 1-yard line. Matt Asiata powered his way in on the next play for a touchdown, and Bridgewater stayed in to zip a crisp two-point conversion pass to Rhett Ellison to push the lead to 35-28.
X-rays were negative, and Bridgewater will undergo an MRI. The Vikings have only three days before they go to Green Bay on Thursday night.
The already banged-up Falcons offensive line was decimated by injuries. Left guard Justin Blalock left with a back injury, right tackle Lamar Holmes went out with a right foot injury and center Joe Hawley had a right leg injury.
Another rookie quarterback, the Raiders' Derek Carr, injured his left ankle and knee in the third quarter of a 38-14 loss to the Miami Dolphins in London. Already short-handed at linebacker, the Raiders lost Kaluka Maiava early in the game.
Cornerback Morris Claiborne (left knee) and linebacker Bruce Carter (quad) left Dallas' victory over New Orleans. Saints left tackle Terron Arm-stead left because of a concussion.