GLENDALE, Ariz. (AP) - The Arizona Cardinals needed a win and some help to get into the playoffs.
They got neither, though it won't diminish what they were able to accomplish in one season under new coach Bruce Arians.
Arizona rallied from a 17-point deficit to tie the game late in the fourth quarter, but couldn't stop San Francisco in the final 29 seconds. Phil Dawson kicked a 40-yard field goal as the game ended to give the 49ers a 23-20 victory on Sunday.
''It's been a good year,'' Arians said. ''I really hate to see this football team's season end because it's been so much fun working with them. No team stays the same in the NFL, there's so much change and turnover. We'll do everything we can to keep the core of this team together because there are a lot of winners in this locker room.''
Arizona (10-6) made a dramatic turnaround in its first season under Arians, doubling its win total from last season's 5-11 collapse.
The Cardinals came up just short of the playoffs, though, unable to hold off the 49ers or get help from the New Orleans Saints, who clinched the NFC's final playoff spot by rolling over Tampa Bay.
The Cardinals fell behind the 49ers 17-0 in the first quarter thanks to a rash of dropped passes, errant throws and an inability to cover Anquan Boldin, the former Arizona receiver who finished with nine catches for 149 yards.
Arizona (10-6) rallied behind its defense in the second half, tying the game at 20 on Andre Roberts' spectacular 34-yard touchdown catch with just over three minutes left.
Dawson followed with a 56-yard field goal, but Jay Feely, who missed two kicks earlier in the game, tied it on a 43-yarder with 29 seconds left, giving the Cardinals hope of ending the season with a victory.
Instead, the 49ers snatched it away, setting up Dawson's final attempt with a big kickoff return by LaMichael James and an acrobatic 24-yard catch by Quinton Patton along the sideline with 2 seconds left.
Dawson's kick was true, sending the 49ers charging out onto the field and the Cardinals into the offseason with plenty of confidence despite the disappointing finish.
''It's unfortunate,'' Cardinals defensive tackle Darnell Dockett said. ''We played great ball and we came up short.''
The Cardinals went into the game clinging to playoff hopes, needing a win over the 49ers and a loss or tie by New Orleans. The start couldn't have gone much worse for the Cardinals.
With the scoreboard showing New Orleans out to a quick 7-0 lead, the 49ers marched quickly on their opening drive for a 27-yard field goal.
The Buccaneers tied the Saints, but the good news didn't last for the Cardinals; Carson Palmer threw a ball that was intercepted by NaVorro Bowman, who returned it to Arizona's 22-yard line. Colin Kaepernick hit Boldin on a 4-yard touchdown pass five plays later.
Feely then missed his first field goal, from 37 yards, and Boldin turned a short catch into a 63-yard play to set up another 4-yard touchdown pass, from Kaepernick to Vernon Davis.
While the story on the scoreboard continued to be grim - the Saints went up 21-7 on Drew Brees' third TD pass - the Cardinals finally started to hit a rhythm on offense.
Arizona also stiffened on defense in the second half, pulling within 17-10 when Feely hit a 49-yard field goal early in the fourth quarter.
The problem for Arizona was it didn't matter at that point; the Saints were rolling, up 42-17.
With the playoffs out of reach, the Cardinals refused to quit, putting together a rally that came up just short. A disappointing finish, but Arizona did win six of its final eight games after going 1-11 to close out the 2012 season.
''The one thing that impresses me most is just how much better we are than at the start of the season,''` Arizona tackle Erin Winston said. ''People think that's everybody, but it's not. A lot of teams don't get better during the season. This team is probably the most improved in the league.''
NOTES: Palmer threw for 407 yards to become the first player in NFL history to throw for over 4,000 with three different teams. He also eclipsed the mark in Oakland and Cincinnati. ... San Francisco RB Frank Gore had 14 yards on 13 carries, leaving him 34 short of becoming the 29th player in NFL history to reach 10,000. ... Cardinals NT Alameda Ta'amu suffered what Arians said appears to be a torn right ACL after landing awkwardly in the first half.