The Cardinals had another chance to get even closer, but Feely pushed a 43-yard field goal attempt wide right again midway through the final quarter.
But the Cardinals were not done. After forcing the 49ers to punt after four plays from scrimmage, Palmer led them downfield just like he did during last week's 17-10 stunner in Seattle and completed a long touchdown pass.
This time, it was a 35-yarder to Andre Roberts, who cradled the ball awkwardly but held onto it as his body hit the ground and rolled out of bounds in the left corner of the end zone.
With 3:20 left in regulation, it suddenly was tied at 17-17.
However, it would not matter for the Cardinals because at that time, the Saints were rolling over the Buccaneers midway through the fourth quarter.
Dawson kicked a 56-yard field goal with 1:50 left to give the 49ers a 20-17 lead, but Palmer led the Cardinals down the field and gave Feely a shot at some redemption. Feely made a 43-yarder with 34 seconds left to tie it, but that's the best Arizona could do.
Kaepernick hit Quinton Patton for a huge 29-yard gain on the 49ers' ensuing possession, and Dawson won it with his 40-yard field goal.
"It's been a good year," said Cardinals first-year coach Bruce Arians, whose team mad a five-win improvement from last year. "I really hate to see this football team's season end because it's been so much fun working with them and because no team stays the same in the NFL anymore. There's so much change and turnover. We will do everything we can to keep this core group of this football team together because there are a lot of winners in this locker room and they learned how to win this year.
"I'm very, very proud of them."
NOTES: Cardinals nose tackle Alameda Ta'amu suffered a right knee injury in the second quarter and did not return. ... San Francisco RB Frank Gore entered the game needing 47 rushing yards to hit 10,000 in his career. He finished with 14 yards on 13 carries, leaving him 33 yards shy of the milestone. ... Arizona's defense allowed just five rushing touchdowns on the season, setting a new franchise record for a 16-game season. The previous low was seven rushing TDs in 1994.