Maryland’s Aaron Wiggins loses the ball to Purdue’s Aaron Wheeler, left, during the Terrapins’ 62-60 loss Thursday in West Lafayette, Ind. (Michael Conroy/Associated Press)

Despite being in the midst of a scoring drought that had lasted more than four minutes, No. 23 Maryland still had a chance and, even more importantly, a few precious seconds with which to work.

Maryland trailed by two points and was inbounding from under the Purdue basket with three seconds remaining. Terrapins Coach Mark Turgeon crafted a plan that included three options, the final of which resulted in Anthony Cowan Jr. with the ball in his hands and a shot at a last-second victory over Purdue.

But Purdue’s Nojel Eastern closed quickly on Cowan and partially blocked his three-pointer, sending Maryland to its first Big Ten loss, 62-60, at Mackey Arena.

Making the loss even more frustrating? The fact the Boilermakers — who entered Thursday’s game on a two-game losing streak — couldn’t manage a field goal over the last 5:18.

“I can handle not scoring, but I would like to be able to get a little better looks than we were getting,” Turgeon said. “But give [Purdue] credit. They took us out of everything. . . . It felt like they had six guys out there. They were everywhere.”

As well as the Terps (7-2, 1-1) defended down the stretch, when they limited the Boilermakers only to trips to the free throw line, the Boilermakers also found ways to rise to the challenge. The Terps hit just 35 percent of their attempts from the field, and Purdue (6-3. 1-1) went on a decisive 7-0 run late in the second half that provided enough cushion to withstand one last Maryland charge.

Purdue’s final defensive stand put an exclamation point on a difficult finishing stretch for the Terps. Knowing what Purdue came out of the timeout attempting to stop, the Terps attempted to counter.

Cowan, who had a team-high 18 points, said the Terps will learn from the loss.

“I know we went through a little stretch where we couldn’t score,” Cowan said. “But . . . we’re just going to get better from this.”

The Terps connected on just 9 of 27 shots from beyond the arc, including 4 of 14 in the second half.

Despite his team’s shooting struggles, Turgeon said the difference was Purdue’s Aaron Wheeler, Grady Eifert and Matt Haarms combining for six three-pointers to support Boilermakers star Carsen Edwards, who scored a game-high 20 points despite finishing the night just 4 for 15 from the field.

Maryland’s inexperience in the closing minutes didn’t help.

“We didn’t play with poise; we didn’t coach with poise,” Turgeon said.

Cowan hit a pair of free throws with 7.2 seconds remaining and split another two with three seconds remaining. His miss on the second of those free throws went out of bounds off a Purdue player, setting up one last piece of drama.

While Turgeon suggested other options were there, Cowan seemed destined to take the decisive shot. Afterward, both Turgeon and Cowan insisted that, as the season progresses and more offensive sets get installed, the Terps will have more options for such moments.

“The young guys can contribute, but it’s a young season,” said Cowan, a junior and former All-Met at St. John’s. “It’s the second conference game. I’ve still got a lot of faith in them.”

The more Purdue gained control as the second half wound to a close, the louder the environment inside the cozy confines of Mackey Arena became. After the Purdue student section’s beloved chants of “Boiler Up” were met with timely baskets in the first half, the enthusiasm rose to a fever pitch once the Boilermakers took the lead for good.

Cowan’s jumper with 7:49 remaining broke a tie at 52 before Purdue — led by Edwards and Wheeler, who finished with 15 points, provided the Boilermakers with a 57-54 lead with 6:07 remaining.

“This is a tough place to play,” said Maryland sophomore Darryl Morsell, who finished with 12 points. “The crowd’s right on top of you, and when [Purdue] goes on runs, it’s loud. They really support their players here.”

The Terps, who led by as many as eight in the first half, took a 34-30 lead into halftime. They shot 41 percent in the first half and forced Purdue into 10 turnovers over the first 20 minutes. Purdue committed only six turnovers in the second half.

Yet even with everything added up, the Terps had a chance at a victory. But in a game that will go down as a learning opportunity — scoring drought or not — Morsell said he and his teammates need to learn how to come through in the big moments.

“At the end of the game, it’s not an excuse to say we’re tired,” he said. “We need to bone up and be tougher than that and find a way to win.”