"When you lose five games in a row and have to come back in somebody else's ballpark, hopefully this gets us back on track," Dodgers manager Joe Torre said. "A lot of good things happened. Hopefully we can build on it. Certainly was a good way to break a losing streak."
Milwaukee was ahead 4-3 in the ninth when Mota (1-2) entered. He had gotten his first save of the season Monday as Gagne took a two-day "mental break" from closing.
Brewers manager Ned Yost had said before the game that Gagne, who has five blown saves in 15 chances, would be available for the ninth. But Yost changed his mind and decided Gagne would rest after throwing 60 pitches in two days.
When David Riske left with one out in the eighth because of a hyper-extended right elbow and Salomon Torres and Brian Shouse finished the inning, that left Mota as the best option for the ninth.
"Everybody knows now in the bullpen you've got to be ready for any situation, so I just tried to go in there and do my job," Mota said. "I wasn't able to do it tonight."
Mota walked Delwyn Young with one out and allowed a single to Andre Ethier that put runners on the corners. Pierre drove a pitch deep to left-center to put Los Angeles ahead 5-4, stole third and scored on Andruw Jones' groundout. It was just the sixth RBI of the season for Jones, who is hitting .179.
"I played with Mota so I kind of know how he is," Pierre said of his steal. "I just read it right."
Joe Beimel and Jonathan Broxton (2-1) combined on a perfect eighth for the Dodgers, and Takashi Saito threw a 1-2-3 ninth for his sixth save.
Los Angeles had been 0-18 when trailing after eight innings.
"Hopefully this win can get us back and track and hopefully everybody can settle down and just play baseball," Pierre said. "Overall, pitching and offense everybody is pressing a little bit. That's only natural when you don't win games."
Milwaukee, which had won three in a row, has lost 10 games in which it led at some point.
"I don't think we gave it away," Yost said. "I think that they earned it."
Dodgers starter Derek Lowe allowed four runs and six hits in six innings, while Milwaukee's Manny Parra gave up three runs - one earned - and seven hits in 6 2-3 innings.
Parra's two-run single and Jason Kendall's RBI single built a 3-0 lead in the second. Blake DeWitt hit a solo homer for the Dodgers in the fifth, but Corey Hart's RBI single made it 4-1 in the sixth.
Los Angeles closed with a pair of unearned runs with two outs in the seventh. First baseman Prince Fielder bobbled pinch-hitter Mark Sweeney's grounder for a run-scoring error on an in-between hop.
"Yeah, you'd like that play to be made," Yost said. "It's a tough play, but that play can be made."
Pierre chased Parra with an RBI single, a ball to shallow left that Ryan Braun unsuccessfully tried to catch with a dive.
Notes: The start of the ninth was delayed after a discussion between Yost and 3B umpire Joe West. Mota said that West allowed him only five warmup pitches, but Yost wouldn't talk about what happened. ... Dodgers RHP Jason Schmidt (right shoulder) threw a bullpen session on Wednesday and is to throw three innings on a rehab assignment Saturday in Class A. ... Torre said 3B Nomar Garciaparra (strained left calf) volunteered to play shortstop if he's ready to return from the 15-day DL before SS Rafael Furcal (back).