TAMPA — In one short sequence Saturday, the ups and downs of youth were on display.

One minute, a pair of Tampa Bay Lightning rookies hooked up for a brilliant late goal; the next, one of them is sitting in the penalty box watching a late goal.

Such can be the growing pains for Tampa Bay, which lost on a last-minute power-play goal by Pittsburgh defenseman Matt Niskanen that handed the Lightning a 5-4 loss in front of an announced crowd of 18,939 at The Forum.

Sidney Crosby registered his eighth career hat trick, and his first since the 2010-11 season, and had an assist on the winning goal. Brooks Orpik added a rare goal for the Penguins, who defeated the Lightning for the seventh consecutive time.

Steven Stamkos, Alex Killorn, Valtteri Filppula and Teddy Purcell scored for Tampa Bay, which allowed more than three goals for the first time in five games. Anders Lindback took the loss, stopping 21 shots in his first start since opening night, as the Penguins scored three times on the power play.

Niskanen’s shot from the left point beat Lindback over his right shoulder for the winner.

“It pretty much went straight in,’’ Lindback said. “I sort of lost the pass and the shot from the start. But it’s my job, and I should be there.’’

Tampa Bay had three separate one-goal leads in the game and failed to hold on as the Penguins scored three times in the third period, with the final two coming on power-play chances on penalties by Killorn and Richard Panik — the same players who connected on a late power-play goal to pull the Lightning even with 3:02 to play in the third.

Killorn was called for holding on Evgeni Malkin that led to Pittsburgh’s fourth goal, and Panik for tripping Orpik in the offensive zone with 56.6 seconds left that led to the winner.

“We have a young team, this is a team sport and guys take penalties,’’ Lightning coach Jon Cooper said. “Do I like the way the penalties were taken? Absolutely not. Is it unacceptable? It is. We didn’t manage the game. But in saying that, we have to kill one of those (penalties) off, and if we do we are still playing. They score on both of them, and here we are answering questions about undisciplined penalties.’’

Cooper wasn’t pleased with how the late call was made.

“To be honest, did our guy give (the official) the chance to make a call, he did, but whoever it was went down pretty easy,’’ Cooper said. “Do you take one (guy) there, ref has to make a call and he decided to take one and maybe he could have taken two ... it’s on our guy, because he gave the ref the chance to make the call, so he’s going no matter what, so then it’s the refs decision there now, he has to make the call, did the guy embellish it.’’

The late goal took a lot away from the Lightning’s play, as Tampa Bay went skate-to-skate with one of the top teams in the Eastern Conference. And it took away from what could have easily been a brilliant night for Killorn — who had a goal and an assist — and Panik, who finished with two assists. Panik had a brilliant cross-ice pass to a cutting Killorn in the slot on the power play that helped Tampa Bay rally from down a goal late.

“It’s tough, especially with that much time left in the game, we worked so hard to stay in that game and it hurts,’’ Killorn said. “I know I took a penalty in the end that they end up scoring on, we took a few penalties in the end that a few of us would like to have back, so yeah, we probably need to be a little more disciplined.’’

The game went back and forth, with the Lightning holding leads of 1-0, 2-1 and 3-2 before Pittsburgh took the lead 4-3 and then finally 5-4 at the end.

“I don’t think anybody can sit here and say one team outplayed the other,’’ Cooper said. “I thought it was one heck of a hockey game ... big-time players on both teams stepped up, and they got the last good break with the least amount of time left in the game, so it ended.’’