When the Boston Red Sox traded Clay Buchholz to the Philadelphia Phillies last December, it was to shed his $13.5 million contract.

But Boston did get a player in return. And the Portland Sea Dogs are appreciative.

Second baseman Josh Tobias, who is making himself at home in his new organization, supplied three hits Tuesday night for Portland, including the winner in the eighth inning.

Tobias lined a two-run single to center field, giving the Portland Sea Dogs a 6-5 win over the Binghamton Rumble Ponies at Hadlock Field.

Josh Callahan (4-1) pitched two perfect innings to earn the win.

The Sea Dogs (16-11) trailed 5-3 heading into the eighth. Consecutive singles by Joseph Monge, Jake DePew and Deiner Lopez brought in one run with one out.

After a strikeout and a wild pitch, the switch-hitting Tobias came up against right-hander Corey Taylor (2-3).

“I got a fastball away,” Tobias said. “Tried to pull it. Broke my bat but it died a hero. I’ll take it.”

Nick Longhi went 4 for 5 with a RBI for Portland. Lopez (2 for 4) and Rafael Devers (1 for 4) also recorded RBI.

Tobias, 24, was playing only his seventh game for Portland since his promotion from Class A Salem.

Tobias was a 10th-round draft pick of the Phillies in 2015 out of the University of Florida. He played all last year in Class A, batting .291.

Last December, Tobias was in Colombia when his cell phone rang.

“I was in South America playing winter ball,” he said. “The (Phillies’) player development guy called. I thought that was weird. But then I found out (about the trade), got a plane a few days later and went home (to Greensboro, North Carolina).”

Tobias is batting .276 in Portland.

Sea Dogs right-hander Teddy Stankiewicz started the game and went five-plus innings, allowing five runs, four earned, on eight hits and a walk. He gave up two singles to begin the sixth – Stankiewicz’s first start of less than six innings.

“I don’t think he was as sharp as he’s been but he competed,” Portland Manager Carlos Febles said.

Both runners scored on Jio Mier’s single against Williams Jerez, giving the Ponies (17-11) a 5-3 lead.

Binghamton starter Casey Delgado went five innings. He could have gone longer but was ejected in the top of the sixth for arguing from the dugout. Ponies Manager Luis Rojas offered his opinion and also was ejected.

Callahan relieved Jerez in the eighth and struck out the side.

After Portland’s rally in the eighth, Callahan sealed it, dropping his ERA to 1.38.

NOTES: The announced paid attendance was 2,886. … Sea Dogs regular shortstop Tzu-Wei Lin sat out a second straight day with a sore left wrist. He is day-to-day.