Corey Hart's grand slam with two outs in the eighth inning prevented Philadelphia's Cliff Lee from getting a rare win as the Milwaukee Brewers beat the Phillies 7-4 on Thursday night.

Livan Hernandez (4-1) pitched a scoreless eighth for the victory. Jim Henderson recorded the final two outs for his third save in four chances, getting Erik Kratz to ground out with the bases loaded to end the game.

Lee allowed two solo home runs by Ryan Braun and a solo homer by Aramis Ramirez, but little else. With two outs in the eighth and no runners on, Lee got Rickie Weeks to ground to third, but Kevin Frandsen made an errant throw for a two-base error to keep the inning alive.

Philadelphia manager Charlie Manuel then removed Lee after 111 pitches for Josh Lindblom (2-3), who intentionally walked Braun, and then Ramirez walked to load the bases. Hart hit a 2-2 pitch just over the wall in right when Domonic Brown couldn't make the leaping catch.

Hart had struck out in all three at-bats against Lee.

The Brewers snapped a three-game losing streak.

Lee struck out 12 and was in line for only his third win in 22 starts until Hart's late heroics. The left-hander pitched 7 2-3 innings, giving up five hits without walking a batter.

The homers by Braun and Ramirez allowed the Brewers to open a 3-1 lead, but Philadelphia took the lead on Frandsen's two-out double off Milwaukee starter Marco Estrada in the fifth. The right-hander recorded the first two outs of the inning and then fell apart.

Ryan Howard singled to left, Brown walked and Laynce Nix singled to load the bases. Frandsen, recalled from the minor leagues when Placido Polanco went on the disabled list on July 27, hit a 3-2 pitch to the gap in left-center field, with all runners easily scoring to give the Phillies a 4-3 lead.

Estrada took 108 pitches to get through five innings, giving up four runs, eight hits and three walks while striking out one.

Braun took early batting practice nearly four hours before the game in an attempt to snap out of a 9-for-47 slump with no walks and no home runs in his last 49 plate appearances. The NL MVP hit an 0-2 pitch from Lee off the top of the wall in right-center for his 30th homer that gave Milwaukee a 1-0 lead.

Ramirez followed with a homer to center, his 16th, to make it 2-0.

Philadelphia pulled within 2-1 in the third when Jimmy Rollins scored from third on a fielder's choice.

Braun then hit his second homer of the game in the fourth on an 0-1 pitch, marking his fifth multi-homer game this season.

Notes: Polanco, out with back inflammation, went 1 for 3 in his first rehab game for Single-A Clearwater. . Thursday's game was the 50th for Phillies 2B Freddy Galvis in his 50-game suspension for using a performance enhancing substance. Galvis will be placed on the 15-day DL on Friday for a lower back injury. . Braun joined Prince Fielder as the only Brewers to have five seasons with at least 30 homers. . Lee has given up 12 home runs in his last six starts.