The Giants nearly came all the way back from a 6-0 deficit when Freddy Sanchez almost had his third hit of the game -- a potential bases-clearing double -- with two outs in the ninth. But left fielder Milledge retreated and at the last moment dove to his right for a catch on the warning track.
"I knew I could catch it; I just didn't know if I was going to run out of room or not or whether to dive," Milledge said.
The Giants had two singles and two walks against Pirates closer Octavio Dotel but scored only one run before Milledge's catch ended it.
"I just looked back and saw him running back and thought, 'Oh no, he might not get it,'" Dotel said. "But he got it."
"It's a game of inches, and if it would have been an inch away maybe it deflects off his glove," said Sanchez, a former Pirate. "But he stayed with the ball. Give him credit. He made a great catch."
Maholm allowed six hits, did not walk a batter and had one strikeout.
"The defense made some great plays, and I got some groundballs when I needed them," Maholm said. "I guess I was effective in the zone."
Pittsburgh has won three of four since snapping a five-game losing streak.
Andres Torres had three hits, a run and an RBI for San Francisco, which had won six of its previous eight.
Todd Wellemeyer (3-5) was charged with six earned runs and nine hits with three walks and two strikeouts in three-plus innings, his shortest start this season.
"It was a real difficult game," Wellemeyer said. "Just the lack of life on the pitches. I don't think it's mechanical, just more of a dead-arm day issue."
Playing in his 162nd career game one year and one day since being called up with hope that he could help rescue a moribund franchise, McCutchen led off four separate innings with hits: Two doubles, his seventh home run and a single.
"I feel like I can do a lot from the leadoff spot," McCutchen said. "I can start things off, I can get on base, steal bases, get doubles and hit home runs."
He led off the first with a double and scored two batters later on a sacrifice fly by Doumit.
The Pirates batted around in the third, with the first five batters of the inning getting hits against Wellemeyer. McCutchen doubled and scored on a triple by Neil Walker, who reached base three times. Doumit followed with his sixth homer into the seats in right.
The next inning, McCutchen led off with a hit again -- this one a high home run to left on a 1-1 pitch to tie him for the team lead in homers and make it 5-0.
"When he gets on, good things happen for us," Pirates manager John Russell said. "He feels real good about that. It helps our team when Andrew gets on base."
McCutchen's numbers for his first 162 games: .297 average, 19 home runs, 108 runs, 71 RBIs, 35 steals.
"It's been good so far; I guess time flies by when you're having a lot of fun," McCutchen said.
Wellemeyer allowed Walker to reach on a walk and he eventually scored on a Doumit ground-rule double.
The Giants came back from a 4-0 deficit the previous night in Pittsburgh, and they scored twice in the sixth when Sanchez hit an RBI double and scored on a groundout by pinch-hitter Matt Downs.
San Francisco got one in the ninth but came inches short of completing the comeback.
"That was a game-saving catch," Giants manager Bruce Bochy said. "I thought when he first hit it, maybe it even had a chance [for a home run]... [Sanchez] smoked it. That's all you can do. He just made a great catch to save the game there."
The Giants lost for only the third time in 14 games against NL Central teams. ... San Francisco has scored during only three of their past 38 innings played on the road. ... A postgame fireworks and concert promotion led to the second sellout of the season at PNC Park.