By the time the Astros’ celebration was over, Carlos Pena’s hair was a sticky mess. His face, covered in shaving cream, wasn’t much better.

Some teammates poured Gatorade on him. Others threw water at him, and a few others showered him with ice. A polished veteran who takes obvious pride in his appearance, Pena didn’t mind the mess.

If anything, he rejoiced in the celebration after hitting a three-run homer in the 10th inning to lift the Astros to a come-from-behind 7-4 victory over Milwaukee at Minute Maid Park on Thursday.

The Astros overcame three errors and an early 3-0 deficit with solid pitching by Lucas Harrell, Wesley Wright, Jose Cisnero, Jose Veras and Hector Ambriz. Catcher Carlos Corporan tied the game at 4 in the eighth inning with a solo homer, and Pena took care of the rest with a towering shot to right field in the 10th.

“Again, it speaks to the resilience of the group as a whole, and we could not be more proud of that group of men in there,” Astros manager Bo Porter said. “They did a tremendous job. You look at the mistakes that we made early in the game.

“It could have been one of those things where some of those guys held their head down, but not this group here. They kept fighting and found a way to get the game tied, and Carlos (came through) with the big three-run homer.”

Harrell keeps it close

Despite falling behind 3-0 in the second inning on three unearned runs, Harrell kept the Astros in the game and gave up only five hits and four runs (one earned) with three strikeouts over 51⁄3 innings.

“If you look around, we had some impressive performances that are worthy of mention,” Pena said. “Harrell today did a very good job. We made a few mistakes behind him, and they got ahead to an early lead. But he never stopped pitching. He kept on making his pitches, kept us in the ballgame.

“We kept chipping away, having some good at-bats, putting some runners on base, manufacturing some runs, maybe not with the big hits but just moving runners over and so on.”

The Astros made it 3-2 in the fifth inning. After Matt Dominguez followed Justin Maxwell’s one-out walk with a single through the left side, both runners advanced on Jonathan Lucroy’s passed ball.

Running on contact, Maxwell slid home ahead of Lucroy’s tag on Marwin Gonzalez’s fielder’s-choice grounder to first. Brewers first baseman Juan Francisco fielded the ball and threw to home, but his throw wasn’t in time. Trevor Crowe, who left the game in the sixth inning with a right shoulder sprain, drove in another run with a fielder’s-choice groundout to second.

After Lucroy homered in the sixth, Dominguez hit an RBI double in the bottom of the inning to get the Astros within 4-3.