"It was important to do this against a division team, and to exorcise another demon here today," said Bengals second-year coach Marvin Lewis, who was Baltimore's defensive coordinator from 1996-2001.
It was also Cincinnati's first road victory against a team with a winning record since 1990, and marked the second-biggest comeback on the road in franchise history - second only to an 18-point rally in 1996 against Baltimore.
Matt Stover's fourth field goal put the Ravens up 26-24 with 1:42 left, but Palmer calmly drove Cincinnati (6-6) into position for the winning kick, covering 60 yards in seven plays.
A 32-yard pass to T.J. Houshmandzadeh and a 22-yarder to Chad Johnson were the key plays in the drive.
Palmer, a second-year pro, went 29-for-36 for a career-high 382 yards. Houshmandzadeh had 10 catches for 171 yards and Johnson amassed 161 yards on his 10 receptions.
"T.J. was making plays. Chad was making plays," Palmer said. "And when you give your quarterback a chance to throw the ball like that, against probably the best front seven in this game, those guys are going to get open. The O-line played lights out, and we ended up winning."
Before Sunday, the Bengals had been outscored 73-50 in the fourth quarter.
"Our goal is to make the playoffs, and we couldn't have lost this game and still had that goal," Houshmandzadeh said.
After scoring 58 points one week earlier against Cleveland, the Bengals could muster only a field goal through the opening 45 minutes. But Palmer brought Cincinnati back.
"I think that was definitely a breakout game for him," Bengals guard Eric Steinbach said. "He just led the huddle. We had to score quick, and that's what we did."
Chester Taylor ran for 139 yards and a touchdown in place of the injured Jamal Lewis, but it wasn't enough for the Ravens (7-5).
"Give credit to the Bengals," Baltimore coach Brian Billick said. "They fought back from every situation."
The loss all but ended the Ravens' bid to repeat as AFC North champions and endangered their odds of reaching the playoffs as a wild-card team.
"We've got a real uphill climb," Billick conceded.
Baltimore took a 20-3 lead late in the third quarter when Ed Reed intercepted an overthrow by Palmer and took it 21 yards before fumbling. Teammate Chris McAlister scooped up the loose ball and took it 64 yards into the end zone, breaking several tackles along the way.
At that point, the Bengals appeared doomed to yet another lopsided defeat in Baltimore. But Palmer had other plans.
He followed a muffed punt by Ravens rookie B.J. Sams with a 13-yard touchdown pass to Johnson, then tossed a 12-yarder to Johnson to bring Cincinnati to 20-17.
Stover answered with a field goal, but a 9-yard TD pass from Palmer to Houshmandzadeh put the Bengals in front 24-23 with 5:38 left.
"It would be nice to say it was just one thing, but it wasn't," Ravens defensive coordinator Mike Nolan said. "We played poorly, and not in just one area."
Following a lackluster first half dominated by both defenses, the Ravens moved 85 yards on 12 plays in the opening drive of the third quarter to go up 13-3. Kyle Boller went 5-for-5 for 46 yards, including a 13-yarder to Taylor on a third-and-9 play, and Taylor capped the drive with a 1-yard plunge.
Boller went 19-for-33 for 172 yards, but was clearly outdone by Palmer, who bestowed a share of the credit to offensive coordinator Bob Bratkowski.
"Coach Bratkowski called a phenomenal game," Palmer said. "He was guessing right, getting T.J. open, getting Chad open, running the ball at the right time and then backing out."
Notes: Bengals LB Marcus Wilkins left after a blow to the head. S Kim Herring also left in the third quarter to have X-rays on his left arm. ... Before Sunday, the Ravens were 35-0 under Billick when holding a two-touchdown lead.