Adams doubled to deep right and Peralta brought him home with a single in the 10th inning and the Cardinals survived 7-6 Friday night to stay alone atop the NL Central.
"That's a big win," said reliever Pat Neshek. "That's a huge, huge win, and tomorrow I think it's going to really carry over."
With Pittsburgh winning 3-1 at Cincinnati, the Cardinals remain a game up on the Pirates, with two to play.
The game came hours after the Diamondbacks announced manager Kirk Gibson had been fired.
"We gave them a nice little run tonight," said bench coach Alan Trammell, filling in as manager over the weekend. "We were just again, probably a broken record, a little short. Give our guys a lot of credit for battling."
Neshek, superb all season but struggling some recently, gave up three runs that tied it for Arizona in the sixth. Two of the hits were bloop singles. The second of them, by Didi Gregorius, brought in two runs.
"It seemed like everything was just out of reach," Neshek said.
Ender Inciarte followed with a sharp hit to left that, to the good fortune of the Cardinals, bounced into the seats for an RBI ground-rule double. Gregorius, who had crossed the plate with what would have been the go-ahead run, had to go back to third.
But the Cardinals didn't let this one get away.
"I think we just believe we're going to pick each other up," St. Louis manager Mike Matheny said. "You know Pat Neshek's picked us up all season long and been as good as anybody in that eighth inning. Just a couple things not going his way put us in a tough spot."
Marco Gonzales (4-2) shut down the Diamondbacks in the ninth to set the stage for the Cardinals' 10th-inning success.
"It was an interesting kind of feel in the dugout," Matheny said. "We got out of that inning with Marco, you could just tell something was going to happen."
Peralta also had a two-run double in a game St. Louis led 6-3 going into the eighth.
Evan Marshall (4-4) took the loss.
Trevor Rosenthal pitched a perfect 10th for his 45th save in 51 opportunities.
St. Louis was trailing 2-1 in the sixth inning when Peralta launched a bases-loaded double over the head of A.J. Pollock in deep center, bringing in two runs. Yadier Molina followed with a sacrifice fly and it was 4-2. The Cardinals added two more in the seventh
Cardinals: Wacha pitched 4⅔ innings in his previous start after skipping an outing for rest and work on his conditioning following his long stay on the DL. He missed 68 games due to a stress reaction in his right shoulder.
Diamondbacks: INF Chris Owings was a late scratch as a precautionary measure due to a sore left shoulder. ... Arizona is finishing the season with five on the DL, four due to Tommy John surgery -- Bronson Arroyo, Patrick Corbin, David Hernandez and Matt Reynolds.
Cardinals: RHP Lance Lynn (15-10) makes his team-leading 33rd start of the season with the Cardinals needing a victory to clinch at least a tie for first in the division. Lynn is one shy of 50 career wins.
FIRED BUT STILL HERE
Sometimes fired doesn't mean fired right this minute.
Trammell was fired along with Gibson. But Trammell is still working. He agreed to manage the Diamondbacks' final three games.
"I will finish things up and then I will be on my way," he said. "Then you will probably see me somewhere else, who knows?"
Kevin Towers is still in the organization three weeks after being dismissed as general manager.
With the loss, the Diamondbacks (63-97) have dropped eight of nine and are guaranteed to finish the season with the worst record in the majors, and the first pick in next year's draft.
The Cardinals were not swept in a series all season.
The best from Brad Hand in 2020
Check out highlights of Brad Hand closing games for the Indians as he racked up a league-leading 16 saves in 2020.
Sources: Brad Hand, Washington Nationals agree to 1-year, $10.5M deal
Closer Brad Hand, who led the majors with 16 saves last season, and the Nationals are in agreement on a one-year, $10.5 million contract, sources said
Is Jameson Taillon a good pickup for the Yankees?
David Schoenfield breaks down the Yankees' decision to make a trade with the Pirates for Jameson Taillon.
In Jameson Taillon, did New York Yankees trade for latest starter who will dominate after leaving Pittsburgh Pirates?
Like former Pirates Gerrit Cole and Tyler Glasnow before him, Taillon could shine in his new home -- but is also another question mark in a New York rotation full of them.
New York Yankees acquire pitcher Jameson Taillon from Pittsburgh Pirates for four prospects
The Yankees have acquired pitcher Jameson Taillon in a trade with the Pirates, adding another bounce-back candidate to their rotation.
How timing and circumstance finally allowed the Toronto Blue Jays to land a star
The Blue Jays haven't been successful in landing the big name. Instead, they've often been used as leverage. This time, with George Springer, they got their man and are poised for big things ahead.