Forward Damonte Dodd walked down the court with a smile after forward Justin Jackson drew a foul with six minutes and 27 seconds remaining in the Maryland men’s basketball team’s game against Oklahoma State on Saturday night. The Terps had a chance to gain their first lead since the opening minute.

To that point, Maryland never put a significant dent into the Cowboys’ lead. Oklahoma State set the pace throughout and gained a double-digit advantage midway through the second half.

But to cap an 11-0 run, Jackson drained the two free throws to give Maryland a 61-60 lead. The foes went back and forth for the remainder before guard Melo Trimble nailed the game-winning foul shots with nine seconds left in front of an announced 17,391 fans at Xfinity Center. The Terps prevailed, 71-70, for their fourth victory by six points or less.

“This group of mine, it’s amazing what they do,” coach Mark Turgeon said. “Our team knew we were going to win. We just keep figuring out how to win these games.”

Trimble led the Terps (8-1) with 13 points, while Dodd and guards Jaylen Brantley and Anthony Cowan also notched double figures. Guards Jeffrey Carroll, Jawun Evans and Phil Forte paced the Cowboys (6-2), who entered Saturday with the nation’s second-best scoring offense, by combining for 45 points.

Oklahoma State set a quicker tempo than the Terps have played all season, pressing full court and double-teaming when Maryland crossed midcourt. For the majority of the opening half, Maryland couldn’t fluster the Cowboys.

The Terps looked rushed on offense at times, committing 13 turnovers in the frame. Through its quick offense and high ball screens, Oklahoma State pulled the Terps’ big men out of the paint, helping the Cowboys out-rebound Maryland, 27-18, despite Turgeon emphasizing the importance of fixing his team’s season-long issue Friday. Dodd and forward Michal Cekovsky each drew two early fouls, and with forward Ivan Bender out with a left knee bone bruise, guard Dion Wiley played power forward.

But trailing, 30-19, about seven minutes before the break, the Terps rattled off a 9-0 run. Trimble assisted on Wiley’s three and finished his own layup before Dodd capped it with a flush.

Still, Maryland’s deficit endured as the Cowboys, who forced the third-most turnovers per game in the country entering Saturday (20.71), finished the half on a 9-2 run to extend their lead to 43-35. Oklahoma State answered Maryland’s scoring spurts out of intermission and regained a double-digit lead by the under-12 media timeout.

“We’ve been in that situation before,” Trimble said. “We just kept believing like we always do.”

That’s when the Terps broke through. Maryland went on that 11-0 run to take a one-point lead. Trimble often takes over late in contests, but four other players scored in the stretch to give the Terps the edge for the first time since 15 seconds into the outing.

“That run really sparked a lot for us,” Dodd said. “It was very relieving.”

Turgeon credited the comeback to Maryland’s improved defense, holding the Cowboys to a season-low points. The Terps kept Evans, who entered the game with the third-most points per game in the nation (24.7), out of the paint with help defense whenever the sophomore sprinted past guard Anthony Cowan.

With 21 seconds remaining, though, Evans drove into the lane and finished a layup to give his squad a 70-69 lead. But Trimble responded by drawing a foul in traffic.

Oklahoma State coach Brad Underwood switched to a 3-2 zone on Maryland’s final possession to stabilize Trimble, but as the junior drove into the lane, Cowboys forward Lucas N’Guessan stepped up on Trimble and made contact with his body.

“It’s not like it’s a surprise whose hands the ball was going to be in,” Underwood said. “It wasn’t where it was going to be in anyone else’s hands, and it wasn’t where I expected him to pass it. We felt good about being in the zone. I give a lot of credit to Melo, and Mark put him in a good spot to make a play.”

From there, the contest finished much like Maryland’s win over Georgetown on Nov. 15.

Trimble sunk the free throws, and Evans’ shot rattled out of the rim before his second look came after the buzzer. The Terps bench sprinted onto the court in celebration. After a loss to Pittsburgh on Tuesday, Maryland’s heroic finishes returned.

“That’s just another day in the office for [Trimble],” Brantley said. “We know what to expect from him. Everyone at Maryland knows what to expect from him.”