By Dean Michaels

It was a game that went down to the wire with plenty of dramatics.

But perhaps nothing was more dramatic than the post-game coaches' handshake.

Controversy surrounded the two head coaches after Detroit's Jim Schwartz shook hands with 49ers skipper Jim Harbaugh, who also slapped the Lions mentor on the back. Schwartz suddenly charged Harbaugh and the two coaches had to be separated.

"I went to congratulate Coach Harbaugh and got shoved out of the way." Schwartz said. "I didn't expect an obscenity at that point, so it was a surprise to me at the end of the game."

Asked who shouted the obscenity, Schwartz replied, "I'll just leave it right there. I'm sure it's on the video. (I) went to shake an opponents' coach's hand. Obviously, you win a game like that, you're excited, but I think there's a protocol that goes with this league."

Harbaugh said he caught up with Schwartz in the tunnel after the game.

"I didn't apologize, but I said 'I shook your hand too hard,' it was on me," Harbaugh said. "I don't think I'm emotional. But I was emotional the way the guys played.

Schwartz was told of Harbaugh's comments.

"I'll just say, that, you know, it was a big win for them and they were excited about it and I think I'll just leave it there," Schwartz said.

"I was really revved up and it's totally on me," Harbaugh said. "I shook his hand too hard."

Asked if he was agitated that Schwartz chased him after the handshake, "Harbaugh replied, "I was not agitated, believe me. Not agitated, very happy, very happy with the win. It's a great thrill of winning, great feeling of victory. I'm really proud of our football team."

Smith's TD pass to Walker on fourth down gave the 49ers a 22-19 lead with less than two minutes to play.

"Once he called the play, I had a feeling it was coming to me," Walker said. "Alex made a nice throw, right in the pocket."

David Akers added a 37-yard field goal for the 49ers with a minute to play and the Lions couldn't overcome the deficit.

"We're not going to go 16-0," Schwartz said. "We didn't play our best in any of the three phases: offense, defense or special teams. It still came down to one play at the end on defense and we fell just short. We have to do a better job in all three phases. We have to protect the quarterback better, have to run the ball better, make more plays down the field; we have to stop the run better. We have to cover our kicks better, we have to convert field goals."

Matthew Stafford passed five yards to Nate Burleson for a touchdown to give the Lions a 19-15 lead early in the fourth quarter.

The pass was initially ruled incomplete by the officials who said Burleson did not have control of the ball before going out of the end zone. The call was overturned by video replay.

The Lions failed in their bid for two points after the go-ahead TD. The 49-yard drive for the Lions was set up on Amari Spivey's pass interception.

Akers booted a 31-yard attempt midway in the third to give San Francisco a 15-13 lead. Jason Hanson had kicked a 24-yard field goal earlier in the quarter to give the Lions a 13-12 advantage.

Akers booted a 55-yard field goal on the last play of the first half to give the 49ers a 12-10 halftime cushion.

Hansen kicked a 25-yard field goal early in the first quarter and Matthew Stafford tossed a 16-yard pass to Brandon Pettigrew later in the period for a 10-0 Lions lead.

The 49ers got to the Lions' 1-yard line late in the first quarter on Frank Gore's 47-yard run. On the first play of the second quarter, Gore ran it in for the touchdown. Midway in the quarter, Stafford was sacked in the end zone by San Francisco's defensive tackle Ray McDonald for a safety.

Detroit was trying to open the season at 6-0 for the first time since 1956. The Lions beat San Francisco 17-13 in 1956 to get to 6-0.

The 49ers had the 314-310 edge in total yards. Smith was 17-of-32 for 125 yards while Stafford was 28-of-50 for 293 yards. Calvin Johnson caught nine passes for 113 yards.

Gore led the 49ers rushing attack with 141 yards. Detroit had 66 total rushing yards.

"That was a great defensive performance by our football team and (I'm) just so proud of our guys today," Harbaugh said.

NFL 2011 - Shaky Ending: Coaches' Confrontation Mars 49ers Victory Over Lions - Week 6