OAKLAND — The first boos came about six minutes into the 2014 season. Matt Schaub threw a pass into the grass after being flushed out of the pocket, resulting in three-and-out for the Raiders’ offense and stirring those familiar feelings of disgust in the O.co Coliseum faithful-but-frustrated.

The mood only got worse when the Detroit Lions took the ball and marched 58 methodical yards, converting three third-down plays along the way, and finished with Matthew Stafford’s 4-yard touchdown pass to Kris Durham, who outleaped overmatched rookie cornerback T.J. Carrie for the grab.

It was 13-0 Lions with two minutes still to play in the first quarter, and the Raiders looked uniformly awful. Schaub had zero time to set his feet and throw the ball. The pass coverage was a mess.

Then something improbable happened. The Raiders tightened up and started playing some football. And they left with a dramatic 27-26 victory that delighted, and perhaps surprised, those in attendance.

“I thought we let them kind of grab the momentum early in the game, which was disappointing,” Oakland head coach Dennis Allen said. “But then offensively we were able to kind of respond back. And then the defense was able to get a stop and get a little momentum back for us. I was proud, guys kept fighting, they kept competing and anytime you get a win I think it’s positive for the football team.”

It started with a long drive behind Schaub, who is trying to resuscitate his once-promising career after coming in a trade from Houston. They were helped by two key Lions penalties – one of them for having 12 men on the field for Sebastian Janikowski’s 55-yard field goal. The kick was good, but Allen chose to take the three points off the board and extend the drive.

It looked like the right choice when Darren McFadden scored on a touchdown run moments later.

Rookie Derek Carr replaced Schaub midway through the second quarter and promptly directed the offense to Janikowski’s 28-yard field goal, cutting Detroit’s lead to 13-10. The defense tightened up around the same time, led by another veteran newcomer – defensive end Justin Tuck, who won two Super Bowls with the New York Giants.

The Lions added a field goal just before halftime, but Oakland’s reserves ultimately got the better of the visitors’.

Early on, it looked pretty bad.

Schaub had the Raiders moving on their game-opening drive, but his pass to James Jones over the middle was tipped by corner Rashean Mathis and wound up in the arms of safety James Ihedigbo. His 38-yard return paved the way for Matthew Stafford’s 28-yard scoring pass to Golden Tate, who had sneaked far behind cornerback Tarell Brown, who is starting for Oakland after seven years with the 49ers.

Oakland temporarily came unglued after that. Schaub’s protection behind a rejiggered offensive line broke down, and the pass coverage remained shoddy. The Lions converted three third-down plays the second time they had the ball, on the way to Durham’s touchdown catch.

The Raiders’ first-team defense played deep into the second quarter, and some of the front-seven starters, including defensive end LaMarr Woodley and middle linebacker Nick Roach, were on the field until halftime. The offensive line played substantially, too.

Carr saw extensive playing time, and probably did well enough to open the door for a potential quarterback controversy. The Fresno State product, selected in the second round of the NFL draft, was 9-of-16 for 109 yards and a third-quarter touchdown pass to tight end Jake Murphy.

“I thought he was better in this game,” Allen said of Carr. “I thought he made some improvement. I thought there were times he threw the ball really accurately, and sometimes when he made some good decisions. There’s still some plays out there I wish we could have back, but I thought overall he took a step forward from where he was at last week.”

But Carr suffered a concussion on a sack by Detroit’s Larry Webster with 5:35 left in the game and gave way to third-stringer Matt McGloin.

McGloin nearly got the Raiders to their first lead right away, but his deep completion to Scott Simonson was broken up dramatically by Lions safety DeJon Gomes. Simonson’s helmet went flying, Gomes crumpled in a heap with a neck injury and the ball came loose and rolled into the end zone, where it was recovered by Detroit’s Brandon Hepburn.

Oakland finally broke through with six seconds left, when McGloin fired the game-winning 19-yard touchdown pass to Brice Butler to complete a 13-play, 68-yard drive.

You can reach Staff Writer Phil Barber at 521-5263 or phil.barber@pressdemocrat.com.