LOS ANGELES -- The Giants got worse while getting better Wednesday night.

After losing their previous four games by a combined score of 30-8, they showed encouraging vital signs by engaging in a typical Giants-Dodgers game -- staying competitive and rallying late. But the last element, sealing the victory, eluded San Francisco as Los Angeles broke a ninth-inning tie on James Loney's bases-loaded walk to secure a 5-4 decision.

Now possessors of a five-game losing streak, the Giants (2-6) must win Thursday's series finale to avoid a winless trip. Even if they triumph, their hopes for a fast start officially have been left behind in Arizona.

The Giants' veterans preached the gospel of calm amid the clubhouse gloom.

"It's too early in the season for us not to look at every day as a new opportunity," center fielder Aaron Rowand said.

"You can't panic. That's the first thing," infielder Rich Aurilia said. "We're eight games into the season. Hopefully the way we came back will kind of snowball for us and get us going offensively."

That comeback appeared stirring, at least temporarily. Rowand's three-run homer off Ronald Belisario in the eighth inning erased a 2-1 deficit and nullified the outstanding work of Dodgers starter Clayton Kershaw, who struck out a career-high 13 batters and allowed only one hit in seven innings, Bengie Molina's second-inning home run.

The Giants had the rest of the game organized more nicely than a model home. They could use their setup relievers, Jeremy Affeldt and Bob Howry, to work the eighth and bring the game to Brian Wilson.

The plan went awry as Los Angeles tied the score in its half of the eighth. Andre Ethier sliced a leadoff single, prompting the Giants to replace Affeldt, who had pitched a perfect seventh, with Howry (0-1). Russell Martin doubled, Loney hit a sacrifice fly and Matt Kemp drilled an RBI single.

The Dodgers loaded the bases against Howry in the ninth as Orlando Hudson and Manny Ramirez singled on two-strike pitches and Ethier drew an intentional walk to set up a force play at home. The Giants got it as Wilson replaced Howry and coaxed Martin's grounder to Edgar Renteria. But the veteran shortstop briefly bobbled the ball, preventing any chance of a double play as the bases remained loaded.

"The grass is wet," manager Bruce Bochy said. "It looked like [the ball] caught him on the heel of his glove. If he gets it clean, we might have a shot at a double play."

Loney drew his game-winning walk on a 3-2 pitch from Wilson, who still hasn't received a save opportunity but was in the game to try to force extra innings.

"You don't like to have him out there in that situation," Bochy said. "But at that point, you're trying to save the game."

Howry, who yielded hits to five of the nine batters he faced, acknowledged that he lacked his best stuff, although he had two-strike counts on Hudson and Ramirez in the ninth.

"The ball wasn't sharp," Howry said. "It didn't have good late life. It had kind of a roll to it."

Though the Giants are rolling downhill, Aurilia, whose single preceded Rowand's homer, insisted that the ballclub should recapture the confidence that reigned after the season-opening series victory over Milwaukee.

"We know that our pitching's going to perform better than they have so far, and we know that we're a better offensive team than we've shown," Aurilia said.

Kershaw, an impressive 21-year-old left-hander, muted San Francisco's offense.

"He was throwing the ball with great velocity tonight," Aurilia said. "I don't think a lot of us had seen him before, which works in his favor. He just kept guys off-balance and can overpower you with the fastball."

Matt Cain, the Giants' most effective starter at this early stage, allowed two hits and walked three in the first inning, yet somehow permitted only one run. Cain ultimately lasted six innings, yielding two runs and seven hits.

Cain's now winless against the Dodgers in 12 career starts. But he was more concerned about the team's welfare than his own.

"For this to end the way it did is a heartbreaker -- and definitely when it happens [against] the Dodgers and in our division," Cain said. "But these guys are tough and I don't think it's going to stick with us very long."