BINGHAMTON, N.Y. — The Portland Sea Dogs were three innings away from a perfect trip.

Instead they are coming off a 5-4, 10-inning loss to the Binghamton Mets as they head to Hadlock Field to begin a homestand Friday night.

Binghamton had threats throughout the game. The Mets rallied with single runs in the seventh and eighth innings to force the tie.

After going down 1-2-3 for the only time in the game in the ninth, Binghamton pulled out the win in the 10th.

Cory Vaughn, who finished 3 for 4 with a walk, opened the 10th with a double to right-center field.

Dustin Lawley reached on a walk.

With pinch-hitter Kyle Johnson trying to bunt, Miguel Celestino (0-1) let loose a wild pitch to move both runners into scoring position.

Johnson then lifted a fly to center to easily score the decisive run.

“Any time we have guys on base, we feel we have a good chance to score,” Vaughn said after the Mets produced 12 hits and had five other batters reached on walks.

“We have a lot of guys who can drive runs in.”

Each of the first four players in the Binghamton order drove in one run, including Matt Clark’s game-tying home run to start the bottom of the eighth, before Johnson came off the bench to drive in the winner.

Binghamton’s comeback prevented Keith Couch from becoming the Eastern League’s first 4-0 pitcher this year and improving to 12-1 in 19 career Double-A starts.

The Mets also ended the Sea Dogs’ six-game winning streak.

While away from home for nine days, the Sea Dogs had won five straight, had two games postponed and sat out another scheduled off day.

The Sea Dogs still have the league’s best record at 12-5.

“They have a good team with a lot of good hitters and a good pitching staff,” Vaughn said. “They go about their business the right way.”

Couch worked out of trouble repeatedly while holding Binghamton to two runs on five hits and three walks in six innings. After a rocky seventh, struggling reliever Nate Reed lasted just one pitch – Clark’s homer – in the eighth.

The Sea Dogs turned three double plays in the first seven innings, including two that shortstop Deven Marrero started to end innings.

Marrero also led the offense with two hits, two RBI and a stolen base.

Mookie Betts, the league batting leader, doubled and scored the first Sea Dogs run in the third, then gave the team a 4-2 lead with a sacrifice fly in the seventh. He went 1 for 4 to extend his streak of reaching base to 51 games, counting the 2013 regular season and playoffs in the Carolina League.

Stefan Welch and Peter Hissey had two hits each, and Shannon Wilkerson scored twice.

The loss was just the second in 12 games for the Sea Dogs.

Designated hitter Carlos Rivero went 0 for 4 with a strikeout and grounded into a double play. He is 0 for 9 in two games after returning from Triple-A Pawtucket, where he was 1 for 4 in three days with the team.

When Rivero was activated prior to Tuesday’s game, right-handed pitcher Matty Ott was placed on the disabled list retroactive to Sunday.