HOUSTON -- J.R. Towles couldn't imagine a better way to end a long slump.
"I've definitely been in some slumps before but breaking out has never been this good because I've never had a walk-off before," Towles said. "I knew at some point I was going to break out and it was going to be big for me. I was putting the ball in play and seeing the ball well. I said it can't be bad too much longer."
"I was trying to get the ball away from (Matt) Kemp," Wallace said. "He's a really good center fielder and I was just praying it got away from him. I didn't know if it would get out or off the wall. I was just watching to see what he would do."
Mark Melancon (4-1) pitched a perfect ninth, striking out two.
Aneury Rodriguez allowed only one runner until Kemp singled in the fourth inning for the Dodgers' first hit. Kemp hit his tying home run in the sixth.
Rodriguez gave up four hits and struck out five in six innings.
Lilly, who has a 7-2 career record against the Astros, allowed only three runners to reach second base in six innings. He allowed six hits.
Bourn's homer was his first career leadoff shot and the first by an Astro since Kaz Matsui on Sept. 23, 2008.
"I consider it a mistake and good hitting," Lilly said. "He got a good pitch to hit and he didn't miss it. More than anything, it was a thing where I guessed wrong. I thought he would take to begin the game. That one mistake cost us the game you could say. It was a mental error more than anything."
Houston missed a chance to take the lead in the seventh with two out. A pitch from reliever Mike MacDougal got past catcher Dioner Navarro and Towles raced home from third. But the ball bounced back to Navarro, who made the tag to end the inning.
The Dodgers had their chances too. They had a runner at third in the fifth inning and runners at second in the seventh and eighth.
"We had our chances through this lineup to get a hit," Dodgers manager Don Mattingly said. "Opportunities are there, but we just haven't seen them get that hit. We have to put pressure on the other club."
The Astros won consecutive series for the first time this season. They took two of three from Toronto before beating Los Angeles two out of three. ... Houston RHP Rubby De La Rosa pitched a scoreless eighth inning in his major league debut Tuesday night. He had just been called up from Double-A Chattanooga. ... Dodgers RF Andre Ethier pinch-hit in the seventh. He also pinch-hit Tuesday night after running into the fence on Sunday.