Did Pe’Shon Howard take a terrible shot or make a brilliant pass? For a sold-out crowd of 17,950 it didn’t matter as Alex Len caught the ball near the rim and laid it in with 0.9 seconds left to give Maryland a 51-50 victory over No. 14 N.C. State, touching off a court-storming celebration after its first win over a ranked team since 2010.

Alley-oop pass or putback of an airball, it was a win just the same after 17 straight losses to ranked teams. The last victory had come over No. 4 Duke in the final home game for Greivis Vasquez. The historic perspective wasn’t lost on Maryland coach Mark Turgeon.

“We haven’t won a big game since Greivis was here. I didn’t come here to be mediocre,” Turgeon said. “I came here to do great things. We haven’t done a lot of great things. This is one great thing.”

The great thing came, according to Turgeon, even though the Terps failed to execute his designed play.

“It was supposed to be an up-screen for Alex, but we down-screened,” Turgeon said. “We were 0-for-timeouts. There wasn’t one timeout they did what I asked, not one. It’s frustrating. We practice timeouts.”

But Howard and Len improvised well. With 5.2 seconds left, Dez Wells threw an inbounds pass to Howard, who drove down the left side of the lane with no hesitation and drew a crowd of defenders. Releasing the ball from the baseline, he found the wide-open Len for an alley-oop bucket or a putback of an airball, depending on your perspective.

“That’s exactly how I drew it up,” Turgeon joked as he entered the press room. “You have to be good, and you have to be lucky.”

Len, who said he was knocked to the floor in the raucous celebration, said it was the first game-winner of his career.

“I’m excited. I don’t really care about my shot,” said Len, a sophomore. “It’s very cool for the team.”

Howard wasn’t made available to reporters after the game.

“[Pe'Shon] says it wasn’t a miss,” Len said. “It was a pass.”

In breaking a two-game losing streak, Maryland (14-3, 2-2) also won with defense, holding the nation’s most accurate team to 31.1 percent from the floor, a season low by far for the Wolfpack. Freshman sixth man T.J. Warren, who entered shooting 67.2 percent, missed all six of his attempts. Freshman guard Rodney Purvis missed all but one of his seven shots.

“We guarded our butts off tonight,” freshman Seth Allen (nine points) said. “It’s because we are such a deep team. North Carolina State doesn’t play that many guys. We were fresh coming off the bench and were able to play harder.”

With three players starting at new positions, the offense of Maryland struggled, shooting just 34.4 percent overall and 16.7 percent from beyond the arc. With sophomore Nick Faust (six points, seven rebounds, three assists) at the point, Len (10 points, six rebounds) at the four and freshman Shaquille Cleare (eight points, five rebounds) starting at the five, the Terps committed 13 turnovers.

“We had a lot of open shots tonight, but guys just weren’t hitting,” Faust said.

With the crowd of 17,950 rocking Comcast, the Terps raced to a 10-0 lead as N.C. State missed its first seven shots. But over the next 11 minutes, Maryland missed all 15 of its field goal attempts. When Howard (seven points, five rebounds, two assists, two steals) broke the dry spell with a driving layup, the Terps could thank their defense for still having the lead 16-13.

After former coach Gary Williams was honored at intermission, Maryland opened the second half just as impressively, scoring on its first four possessions to take a 30-21 lead. With 9:34 left, the lead reached double digits as Wells (four points, three assists, two blocks) scored inside. But N.C. State responded with a 16-3 run, led by junior guard Lorenzo Brown (17 points, eight rebounds, four assists) and capped by a 3-pointer by senior Scott Wood (nine points, five rebounds).

“Offensively, we were pretty bad. We bobbled balls. We had shots around the rim we couldn’t make,” N.C. State coach Mark Gottfried said. “I thought our defense and our effort were phenomenal. Our fight to get back in the game was unbelievable.”

With 1:39 left, Brown put N.C. State (14-3, 3-1) in front 50-49 with a 15-footer. But Maryland withstood two more field goal attempts by Wood, setting the scene for the final clutch play by Howard and Len.

“We can’t even run a play we draw up. Who knows what’s gonna happen tomorrow,” said Turgeon, who was joined in the press room by his parents. “I hope my hair doesn’t turn completely gray before the season’s over.”