PHILADELPHIA — For the second time late Sunday afternoon, Cliff Lee was caught between where he was trying to go and where he might have remained. For the first time, he could laugh about it.

The Phillies had just defeated the Cincinnati Reds, 3-2, on back-to-back ninth-inning homers from Erik Kratz and Freddy Galvis. But no matter how that game would end, Lee was aware of his postgame responsibility.

“I guess I have to stand here,” he announced out loud, in the semi-playful spirit of the moment, as he half-tried to sneak about the clubhouse, “and talk about it.”

He did.So he did.That’s because until Kratz and Galvis redirected fast balls from Cincinnati closer Aroldis Chapman over the left-field fence, Lee was in line to be blamed for what could have been another lost Phillies opportunity. For after Delmon Young led off the ninth with a walk, Lee pinch-ran … and was picked off by Chapman.

Kratz, in the game for the injured Carlos Ruiz, was next … and his third home run of the season forged a 2-2 tie. Said Lee, mocking dismay while understanding that the game should have been over at that point: “I’ve never been so disappointed when a guy hit a home run to tie the game in my life.” Yet Galvis followed by ramming his third homer just inside the foul pole, his teammates evacuated the dugout to meet him at the plate and suddenly, outrageously, what was becoming a tragic day had turned memorable for the Phillies.

Galvis said he had never gotten to enjoy a walk-off home run — at any level.

“In the minor leagues and winter ball, I have had the hit to win the game, but it was like a double,” he said. “It was never a home run, where everybody’s just jumping around.”

Earlier, Ruiz had acknowledged feeling a pop in his hamstring while running the bases, and he will require an MRI today. Also, Ryan Howard reported pain in his left knee, also requiring an MRI.

Considering that until Chase Utley’s eighth-inning RBI the Phillies had gone 16 scoreless innings, that the injuries were accumulating and that a key starting pitcher had almost cost them a victory with a base-running blunder, the Phillies might have settled for just sneaking to Miami, where they will play the Marlins today.

Instead, they savored a 3-2 homestand, that after a 4-3 road trip, all of which hinted, at least, at rebirth.

“We could have sat there and said, ‘Oh, Cliff got picked off. What now?’” Kratz said. “I don’t think anybody did that. I know I didn’t. I know Freddy didn’t. Whatever it felt like in the dugout, I don’t know. But it’s a huge boost for us, that’s for sure.”

Jonathan Pettibone has been boost to the Phils since replacing the injured John Lannan in the rotation, and the late-inning recovery Sunday allowed his career record to remain at 3-0. Pettibone worked seven useful innings, allowing seven hits and two runs, just one earned, that on Jay Bruce’s leadoff home run in the second. Pettibone struck out four, threw 63 of his 104 pitches for strikes, and kept the Phillies close enough to win as their scoring challenges continued.

Justin De Fratus worked a scoreless eighth and Antonio Bastardo contributed a one-strikeout ninth to improve his record to 2-1.

“It’s been a good battle each time out,” Pettibone said. “I have been able to get out of some jams in big spots, and that’s kind of saved me. From there, I have kind of stuck to my game plan and tried to pound the zone as much as I can. And it has worked out so far. I want to keep staying aggressive, mix it up, change speeds and go from there.”

Left fielder Domonic Brown caught Brandon Phillips’ sixth-inning fly ball but threw past first baseman Michael Young while trying to double-up Joey Votto, who’d singled. Todd Frazier delivered Votto from second with a double for a 2-0 Cincinnati lead.

Jonathan Broxton replaced starter Homer Bailey in the eighth and surrendered a two-out infield single to Ben Revere, who was 3-for-4 with a double. Revere stole second and scored on Utley’s single off of Sean Marshall to center.

Chapman entered in the ninth, and was one out closer to his ninth save when he caught Lee. But five pitches later, his record was 3-2 and the Phillies had won the series.

“I thought we hit some balls hard off of Bailey,” Charlie Manuel said. “We stayed with them. And something good happened for us at the end. That’s what you have to do.”