Perez also drove in two runs for the Mets, who played small ball to perfection in manufacturing all of their runs. Marlon Anderson snapped an 0-for-25 slump with a base hit and also had a pair of RBIs for New York.
Josh Hamilton homered and had two hits for the Rangers, but the best hitting club in the American League managed just one other hit in its first game against the Mets at Shea Stadium.
New York had lost six of its last seven, including a four-game sweep at San Diego, and rumors were ramping up again that Randolph's job was on the line.
"It's a little tougher to sleep," he acknowledged before the game.
Salvation came in the form of a pitcher who's been about as topsy-turvy as the Mets.
A disaster one game and dazzling the next, Perez (5-4) gave up one run and three hits to win for the first time since May 18. He struck out eight, including David Murphy to leave the bases loaded in the sixth inning.
After Hamilton lined an 0-1 pitch over the left-field wall with two out in the first, the hard-throwing left-hander didn't allow another hit until Rangers starter Scott Feldman delivered the first of his career to open the sixth.
By then, Jose Reyes had scored twice and Carlos Beltran also had reached home on an error to give the Mets a 3-1 lead.
New York's starting rotation has been the least of its problems lately. Along with Perez's strong outing, Mets starters have given up just 15 runs in the past 10 games and have kept the team in every one of them.
But the bullpen has been another story, and a big reason why the Mets (32-34) began the night 7 1/2 games back in the NL East and a season-worst three games below .500.
There were fresh reports that Randolph might not make it through the weekend, a possibility that didn't appear to lose any traction when general manager Omar Minaya was noncommittal about the skipper's future before the game.
"Bottom line is, I'm just not going to answer every report that's out there," Minaya said. "This is a game of performance and you have to do certain things."