Max Costes had a 2-1 count with two outs and the bases loaded in the bottom of the sixth. Costes saw the pitch, coiled, and drove through the ball into the afternoon sky. It was a fly-ball to right field and seemed likely to be caught.

But it wasn’t. Instead, it landed perfectly in the outfield grass, like everything for Maryland baseball on Monday afternoon. Michigan had felled the Terps late in their first meeting but they weren’t making the same mistakes this afternoon.

Instead, Maryland left no doubt. The Terps rode a middle-inning surge to a 17-7 shocker over No. 25 Michigan.

Costes’ three-run double was part of a seven-run sixth inning, a frame that flipped the game on its head and sealed a momentous victory for coach Rob Vaughn’s squad. Luke Shliger got the party started for the Terps, driving a double into center field to score Matt Shaw.

[Michigan edges Maryland baseball, 6-5]

On the next at-bat, Tucker Flint brought Shliger home. In a two-strike count, Flint made contact, sending the ball into right field. Shliger was alert on the basepaths, rounding home to push Maryland’s lead to four — one it wouldn’t relinquish.

And the Terps needed all the runs they could get on Monday. Entering into Monday’s contest, the Terps had high hopes for the undefeated Jason Savacool.

But Savacool struggled in his first game against ranked opposition. He gave up four runs and two walks in two innings before getting pulled in favor of Sean Heine.

Still, the Terps were able to overcome Savacool’s early woes, with a number of strong performances at the plate coming from some unlikely sources.

Infielder Tommy Gardiner, hardly known for his power, slugged a two-run shot over the center field wall to cut the Wolverines lead to just one. The senior now has four home runs in his career — all four have come this season.

Outfielder Chris Alleyne added five RBIs, a welcome sight for a player who came into Monday’s matchup with a paltry .224 batting average. The Philadelphia native was a constant terror across the field for the Terps, racking up four hits and swiping two bags in his best performance of the season.

[Max Costes’ four-hit day sends Maryland baseball to 8-4 win over Northwestern]

The first of those five RBIs came in the fifth inning, with Alleyne driving Ben Cowles and Logan Ott home courtesy of a single to right field. It was only the start for Vaughn’s squad, who capitalized off poor fielding and pitching to turn a 6-4 deficit into a 8-6 Maryland lead.

And it wasn’t even close to being done with the Wolverines, pouring through another seven runs in the sixth to blow the game wide open.

Maryland added a pair of runs in the seventh when Flint and Ben Cowles scored on an Alleyne triple. And fueled by their offensive performance explosion, the Terps cruised to victory. Tyler Blohm and Sam Bello got through the remainder of the action mostly unblemished — save for a Michigan home run in the top of the ninth — earning the win and save, respectively.

Whatever it was, Maryland found its groove at the plate. And it was that groove that helped the Terps land a signature win Monday afternoon.