BOWIE, Md. — After two nights of watching the Portland Sea Dogs use late-inning heroics to win, the Bowie Baysox got a measure of revenge Thursday night.

The Sea Dogs’ bullpen surrendered six runs in the seventh inning and the Baysox rallied for a 6-3 victory, averting a sweep of the three-game series.

“It looked like we were cruising there and then we had that hiccup in the seventh,” Sea Dogs Manager Billy McMillon said. “Nothing really to say. We generally pitch better than that. Our bullpen’s been really good all year. Tonight was a hiccup.”

Ryan Dent had a homer and a double for the Sea Dogs, who went 1 for 5 with runners in scoring position.

Portland starter Justin Haley struggled with his control in his second Double-A start, allowing five walks in six innings. He limited the Baysox to three hits and struck out four before leaving with a 2-0 lead.

“He had a lot of long counts,” McMillon said. “He was able to make some good pitches when he had to and get out of a couple jams. Very impressive for six innings when I think he would admit he didn’t have his best stuff.”

Haley pitched out of trouble in the fifth and again in the sixth, when Bowie got its first two on via a walk and hit batsman.

“It was not getting ahead (of the hitters),” Haley said. “The first-pitch strike has really been big for me all season and I struggled with it tonight. My rhythm was a little bit off. We didn’t make a big issue of it. Just kept trying to attack the zone.”

With Haley gone, Bowie sent 10 men to the plate against two relievers in the seventh.

Pete Ruiz (2-1) started the inning but didn’t get an out.

David Freitas singled and Mike Yastrzemski doubled. After Niuman Romero (3 for 4) singled home the first Bowie run, Buck Britton doubled off the wall in right-center, scoring both to give the Baysox a 3-2 lead.

“He’s been very good all year,” McMillon said of Ruiz, who entered with a 1.77 ERA. “This is probably the outing that he’d want to forget.”

After K.D. Kang walked, Ruiz was lifted and Sharlon Schoop’s single off Jeremy Kehrt made it 4-2. After a wild pitch and a strikeout, Chris Marrero bounced a single to left, scoring two more.

The Sea Dogs took advantage of a pair of Bowie mistakes to go ahead in the fourth.

Michael Miller led off with a single and Sean Coyle reached on an error. After both runners advanced on a Nick Additon wild pitch, Michael Almanzar grounded a single to left, scoring Miller.

Dave Chester’s sacrifice fly brought home Coyle, making it 2-0.

Portland had at least one hit in each of the next five innings but didn’t score again until Dent’s homer with two outs in the ninth.

“I thought we did a good job of working good at-bats, trying to see as many pitches as possible,” Dent said. “We just couldn’t come through and really put the game out of reach.”

Bowie’s Matt Bischoff (3-5) pitched two scoreless innings for the win.

NOTES: Coyle led off the sixth by legging out an infield single but went down in foul territory and was helped off the field. McMillon said after the game Coyle appeared to be OK. … Portland split the season series with Bowie 3-3.