Steven Matz is a 23-year-old prospect with a bright future.

Brian Burgamy is a 33-year-old veteran thrilled to be back in affiliated baseball after an absence of five years.

Together, the kid and the old man helped avert a sweep by the Portland Sea Dogs on a stormy Wednesday night at Hadlock Field.

Matz tossed seven strong innings and Burgamy belted four hits to lead Binghamton to a 4-2 Eastern League baseball victory in the final meeting of the EL East’s top two teams.

The Sea Dogs had taken the first two games of the series after being swept in Binghamton earlier this month.

“I really feel like Portland’s got the best team in the league,” said Binghamton Manager Pedro Lopez, whose team went 7-4 against the Sea Dogs in New York but has won only 2 of 10 games at Hadlock. “Every time we’ve played them, in order for us to win, we’ve got to play solid baseball and unfortunately we didn’t do that the first two nights. I’m just glad we were able to do that (Wednesday night).”

The Sea Dogs led 1-0 on Sean Coyle’s 12th home run before Binghamton jumped to a 4-1 lead in the fifth as dark clouds threatened. Portland starter Mike Augliera (4-9) struck out a season-high seven in six innings but yielded eight hits, including three ringing liners to Burgamy, whose second double of the game came off reliever Dayan Diaz.

Originally drafted by the Padres (ninth round) in 2002, Burgamy was released twice in spring training, once in the Mexican League and bushwhacked through five seasons of independent baseball, including the Atlantic League, the American Association, Australia and Mexico again before the Mets, who had set him loose in 2008, gave him another chance this year.

“I never even thought about (quitting),” said Burgamy, who raised his batting average to .259 to go along with 18 homers and 21 doubles. “This is what I plan on doing until I can’t play anymore or nobody wants me.”

Matz (4-1, 2.75 ERA) is a Long Island native and second-round pick of the Mets in 2009 who underwent ligament replacement surgery in his left elbow and didn’t pitch for two seasons until finally making his pro debut in 2012, more than three years after being drafted. He opened this season in the Class A Florida State League and joined Binghamton in the middle of June.

“A lot of rehab, a little frustration from time to time,” Matz said of his years off the mound. “Throughout the process, I had doubts that I would ever come back from it. But it all worked out.”

In addition to a mid-90s fastball, Matz showed impressive off-speed pitches, including a change-up and a curveball that he used to escape a one-out, bases-loaded jam in the fourth with consecutive strikeouts of David Chester and Jonathan Roof, to preserve a 2-1 lead.

Matz retired nine of the first 10 Sea Dogs and the last five. He struck out four, walked one and scattered seven hits. Chester’s RBI single in the sixth provided the only other Portland run.

Randy Fontanez and Cody Satterwhite, who earned his ninth save, finished off the eighth and ninth as rain began to fall and lightning emptied the stands. Because of the conditions, Sea Dogs management postponed planned fireworks until a July 31 game against Trenton, which was moved up to a 6 p.m. start.

The Sea Dogs begin a four-game series in New Britain Thursday before returning to Hadlock for a seven-day stretch against Reading and Trenton.

NOTES: Left fielder Peter Hissey did not play after crashing into the wall in the eighth inning of Tuesday’s 4-3 victory. Hissey said he hit his head while attempting to catch what ended up a triple by Dilson Herrera, and sustained a concussion.

“I feel pretty good,” said Hissey prior to Wednesday’s game. “I just have to wait to feel better.”Hissey, batting .352 in his past 30 games, already missed most of June after being struck in the head by a pitch on May 31. He said this is the fourth concussion of his career.