Wall, who made his Major League debut, got the win and just in time, as he's likely to be returned to Triple-A Albuquerque on Monday, when Chad Billingsley comes off the disabled list.
James Loney got the hit that started the rally, Tony Gwynn legged out a sacrifice bunt for a hit that set it up, Luis Cruz's RBI single extended it and Adam Kennedy's two-run double completed it.
After losing 18 of 24 and falling from five games up to three games behind in the National League West, the Dodgers take a modest four-game win streak and renewed confidence into sweltering St. Louis for a four-game series. They are 5-2 in extra innings and 1 1/2 games behind San Francisco.
"Everybody wanted -- as soon as Matt [Kemp] and Andre [Ethier] came back in the lineup [from the disabled list] -- for us to turn it back on," said Kennedy. "The reality of that is not good. Hopefully, we can get that feeling back now."
Manager Don Mattingly pretty much pushed all the right buttons in this one, including using reigning NL Cy Young Award winner Clayton Kershaw for a successful sacrifice bunt as a pinch-hitter and getting hits from four players that did not start.
Most notable of that group was Treanor, who was batting .203 on the season and .091 against the Mets this year before his 12th-inning at-bat. Facing Ramon Ramirez, he fouled off three consecutive pitches before bouncing his single up the middle.
"We haven't been stellar on the road this year, so to start a 10-game trip on a positive, I think, it's huge," he said. "We're getting back into the we-can-do-it mode. We're not just coming to the park trying to figure a way to win.
"I've been scuffling quite a bit. I think this could carry me into the next series, and it will make for a happy flight to St. Louis."
Rookie starting pitcher Nathan Eovaldi, deploying a cutter he picked up from pitching coach Rick Honeycutt only days earlier, pitched effectively but not long enough. He allowed only one run with seven strikeouts and one walk, but was removed after 4 1/3 innings because of a high pitch count (96).
It was the last thing Mattingly and Honeycutt wanted to do, knowing they couldn't use closer Kenley Jansen or setup man Ronald Belisario and wanted to avoid using Josh Lindblom because of their recent heavy workload.
Mattingly and Honeycutt nursed 7 2/3 innings from the bullpen. They got 1 1/3 innings from Scott Elbert, 1 1/3 innings from rookie Shawn Tolleson, one inning from long reliever turned setup man Jamey Wright, two innings from Javy Guerra (only days ago after returning from visiting his ailing father), an inning from Wall and one from Lindblom, who was forced to finish up.
"I'm satisfied the guys hung in there," said Mattingly. "We didn't want to use Kenley, Belly and Josh and that's hard to do, and we just about did all of it, and at the end of the day, we got a win like that -- it makes it worthwhile."
Guerra, who lost his closer's job to Jansen in May, had a chance for his first save since May 1 but allowed two hits and the tying run in the bottom of the ninth. He nearly lost the game, too, putting runners on first and second with no outs in the 10th, but pitched out of the jam by getting Ruben Tejada on a double-play grounder.
"Javy, to me, was throwing the ball fine," said Mattingly. "After giving up a run, he got out of a tough situation. That shows his toughness."
Wall had been the eighth reliever in the bullpen since his recall July 14, meaning he hadn't pitched in a game. Nice time for his debut, huh?
"At that point," said Mattingly, "there really was nobody else."
Despite the lack of game action, Wall said as this one unfolded he anticipated he might be called on.
"It was pretty cool, an amazing experience," he said. "I was nervous a little bit, but being here and getting up once or twice [in the bullpen] and not getting in actually helped settle me down.
"When I got in, I made it like the same situation I pitch in Albuquerque and made my mind believe that's exactly what the situation was. I was only thinking about throwing strike one, and when I got that, I felt comfortable."
Juan Rivera slugged a two-run homer that gave the Dodgers a fourth-inning lead.