The score came with 2:16 left and capped a 14-play, 68-yard drive in which Smith was a non-factor. Smith, the NFL's leading receiver this season, finished with three catches for 55 yards.
"They rolled to Smitty a good bit and we had to be patient," Delhomme said. "Just take what they give you. It was going to be one of those games where you were going to have to be smart."
Delhomme was both patient and smart. He finished 20-of-27 for 191 yards passing, erasing the dreadful memories of his performance last weekend, when he threw two interceptions and was sacked a career-worst eight times in a 13-3 loss at Chicago.
"We came straight at them like we always do," safety Mike Minter said. "We stopped them with seven guys in the box. When you can do that as a defense, you're playing well."
The Panthers limited Buffalo to 216 yards of offense, the sixth straight opponent they've held under 300 yards. They also have 23 sacks in their last six games.
Carolina (8-3) took over sole possession of the NFC South lead, a game ahead of Tampa Bay, which lost to Chicago.
"Everybody had us as the worst team on the planet after that last game," Panthers coach John Fox said. "This has been a resilient bunch."
The Bills (4-7) squandered two three-point leads and settled for Rian Lindell's three fields goals despite three trips inside the Panthers' 20.
"When it counted the most, we stalled," Losman said. "We as a team and as players have to figure out how to win these types of game, these close games."
Making his second straight start, Losman finished 16-of-29 for a career-high 197 yards passing and an interception.
Buffalo has lost four of its last five.
Trailing 9-6 after Lindell hit a 33-yarder, Delhomme started on his 32, heading for the ninth fourth-quarter comeback of his career.
Facing third-and-goal, Delhomme twice faked a handoff, set up in the pocket and threw over the middle to Gaines, who had a step on backup safety Coy Wire. Wire was in the game after starter Lawyer Milloy limped off and didn't return after hurting his right foot earlier in the drive.
The touchdown was the Panthers' first offensive score in more than 131 minutes of game time since Stephen Davis scored on a 1-yard plunge with 13:25 left in the fourth quarter of Carolina's 30-3 win against the New York Jets two weeks ago.
"You can't get frustrated," Gaines said. "You get frustrated, it's like quicksand -- you're going to keep sinking and sinking and sinking. We just kept encouraging each other."
DeShaun Foster finished with 23 carries for 77 yards.
John Kasay rounded out Carolina's scoring, hitting two of three field-goal attempts. He missed a 45-yarder wide right in the third quarter in relatively calm conditions.
The Bills' red zone troubles continued to plague them. They've now scored 11 touchdowns in 32 trips inside an opponent's 20 this season.
In their three red zone drives Sunday, Losman went 0-for-3, while Willis McGahee managed only 7 yards on six rushes -- and the running back was also penalized 15 yards for a chop block.
"We just have not capitalized," Bills coach Mike Mularkey said. "I wish I could explain. It's not that we don't have guys open or don't have the ability to run down there."
Former Bills quarterback Frank Reich was honored at halftime, receiving the Ralph C. Wilson distinguished service award, named after the team's owner. Reich, who also played for Carolina and now lives in Charlotte, N.C., is best known for rallying Buffalo from a 35-3 deficit to a 41-38 win over Houston in the 1993 AFC wild-card playoff game -- the greatest comeback in NFL history. ... Smith now has 1,161 yards receiving, setting a single-season career high. ... The Bills were without three starters: Cornerback Terrence McGee (hamstring), defensive tackle Sam Adams (ankle) and tight end Mark Campbell (hamstring). Buffalo then lost starting left guard Mike Williams, who hurt his back in the second quarter.
Indianapolis Colts quarterback Andrew Luck tried his hand at auto racing on Wednesday, doing a few laps with former Indy 500 champion Mario Andretti.
Broncos offensive lineman Ty Sambrailo will get a shot at guard this season, but the coaches know he also has the ability to play tackle.
New York Jets DT Sheldon Richardson is keeping a positive attitude regarding his offseason workouts and possible discipline from the NFL.
ESPN Jets reporter Rich Cimini says that with Ryan Fitzpatrick still unsigned, Geno Smith led the first-team offense and looked sharp on Wednesday and Smith said he sees this as an opportunity.
ESPN NFL analyst Herm Edwards explains that kicker Blair Walsh will be able to put last year's wild-card field goal miss behind him because the Vikings will provide the opportunity for him to get back in similar situations over and over again.
Undrafted rookie Claudell Louis relishes the chance to play for Buffalo, an opportunity he didn't think possible on his accidental path to football.