DETROIT (AP) - One moment, Dez Bryant was making a terrific catch in the end zone.
Later, he was screaming on the sideline after a Dallas drive stalled.
If the Cowboys had won, it might have all been an entertaining sideshow - but Dallas let this game slip away in the final seconds by committing a crucial penalty and allowing Detroit to drive 80 yards for a touchdown.
Matthew Stafford scored on a 1-yard lunge with 12 seconds remaining to give the Lions a 31-30 win Sunday.
''Everybody knows that we should have won this game,'' Bryant said. ''A game like this - man, it kills you.''
Detroit had extra time left because the Cowboys were whistled for holding, stopping the clock with just over a minute remaining before Dallas kicked a field goal to take a six-point lead.
It was a stunning last-second loss for the Cowboys in an emotional game that included an animated outburst by Bryant and a spectacular performance from Detroit's Calvin Johnson, who nearly set an NFL record with 329 yards receiving.
''I'm passionate about this game, and I'm passionate about winning. My passion is always positive,'' Bryant said.
''People who have a problem with me are the people that don't understand what is going on. The media and people who think I'm a problem - they don't know what they are seeing.''
The Cowboys were outgained 623-268, but were in position to win because they forced four turnovers and committed none.
''It felt like we were going to win the game and we were well aware of the play-making ability that they had with Johnson out there having the day he was having,'' Dallas owner Jerry Jones said.
''They overcame their turnovers and they played through their turnovers and they were able to take home a great victory for them. This was an important victory and it was a very disappointing loss for us.''
The Cowboys (4-4) remain atop the NFC East despite the loss.
Bryant caught touchdown passes of 5 and 50 yards. He also appeared fired up about something as he left the field at the end of a third-quarter series. Bryant was seen screaming on the sideline.
''Dez is a very passionate player, very competitive player,'' Dallas coach Jason Garrett said. ''He gets a lot of attention from the opposing defenses, and he just wanted the football, and we want guys that want the football.''
Tony Romo downplayed that scene after the game.
''He's a competitive guy. He never complained to me about getting the ball. He knows that the ball is going to where it's supposed to,'' Romo said. ''When you guys see emotion sometimes from Dez, it's just trying to rah-rah, more than it is being a `me' guy. That's not who Dez is.''
Bryant had a quiet first half until he caught a short touchdown pass from Romo, pinning the ball against his shoulder pad with his left hand to give the Cowboys a 10-7 lead with 46 seconds left in the second quarter.
Bryant's 50-yard catch-and-run put the Lions (5-3) behind 27-17 in the fourth, but Detroit rallied.
The Lions were down 27-24 and out of timeouts when Dallas' Phillip Tanner ran for a 9-yard gain on third-and-14 with just over a minute remaining.
The clock would have kept running, but offensive lineman Tyron Smith was called for holding. Detroit declined the penalty, setting up fourth down, but the clock was stopped at 1:07.
Dan Bailey's third field goal of the day put the Cowboys ahead 30-24, but the Lions still had about a minute to do something.
''If we don't get called for a penalty, I think they probably had 20 or so seconds left,'' Romo said.
Detroit went from its 20 to the Dallas end zone thanks to a 17-yard pass from Stafford to Johnson, a 40-yard connection with Kris Durham and a pass to Johnson that put the ball at the Dallas 1.
Stafford appeared to catch his hometown Cowboys by surprise. Some of them seemed to expect him to spike the ball to stop the clock.
Instead, Stafford took the snap and leaped with his arms extended to beat the team he rooted for growing up in Highland Park, Texas.
''We played it as well as we could,'' defensive tackle Jason Hatcher said. ''It was one of those smart things. He made a very smart play there. He's a good quarterback. He made the play when it presented itself. He kind of caught us off guard.''
Johnson had 14 catches, and his yardage total was 7 shy of the single-game record. Flipper Anderson had 336 yards receiving for the Los Angeles Rams against New Orleans in a 1989 game that went into overtime.
''We had a lot of 1-on-1 coverage today, and we were able to take advantage and hit some deep balls,'' Johnson said. ''Matt made some great throws to me.''
NOTES: Lions DE Ezekiel ''Ziggy'' Ansah (left ankle), WR Ryan Broyles (Achilles tendon) and CB Bill Bentley (knee) and Cowboys RG Brian Waters (triceps) were hurt during the game. ... The Lions have a bye next week while Dallas plays the Minnesota Vikings.