Funny, improbable things happen in the heat of the summer, the heat of a pennant race, but this was was no mirage.

For seven futile innings in the first game of their doubleheader sweep tonight, the Baltimore Orioles were stymied by that master of antiquity, Gaylord Perry, who was 44 when the game began, pitched like he was 24 and looked like he was 64 by the time it ended.

Eddie Murray ruined Perry's no-hitter with a single in the eighth. In the ninth, Perry watched as the indefatigable Dan Quisenberry failed (for once) to protect a 4-2 lead. With two outs, the Orioles scored three runs and Perry's craftily crafted three-hitter became a 5-4 Orioles victory.

"It keeps people in their seats," said Ken Singleton, who drove in the tying run. "We don't want them to start their motors and listen to the rest on the radio."

The crowd that trickled in during the first game, wondering what they had missed, stayed to see the Orioles win the second, 3-1, and regain first place in the American League East. The Orioles hold a one-game lead over Milwaukee, which lost, 9-1, to Oakland tonight.

Jim Dwyer's seventh home run of the year tied it at 1-1 in the sixth. With one out in the eighth, Rick Dempsey doubled and Dwyer walked. With two out and the count 3-2, Cal Ripken Jr. fouled back three of Eric Rasmussen's best fast balls, waiting for one he could hit. He got one, sent it up the middle and sent Dempsey home with the winning run.

It was a startling, exhilarating end to a sunny, languid evening, an evening so still that the Orioles seemed almost comatose early in the first game. In one ungainly inning, the fourth, the Royals scored three runs off starter Scott McGregor on four hits that glanced off four gloves.

Willie Wilson led off with a single to short off Ripken's glove.

(In the ninth inning, Wilson was hit by a pitch and was taken to the hospital. X-rays revealed a crack in a knuckle of his left hand, which was placed in a cast. Doctors said he will be out for three weeks.)

Following Wilson in the fourth, U.L. Washington, stepped to the plate with eight career hits off McGregor, including three home runs. He left it with his ninth hit and his fourth home run, which barely eluded Al Bumbry's glove in center.

The Royals scored another run in the inning on a double to left by Amos Otis and a single by Frank White. Another run in the sixth made it 4-0.

After all these years, Perry still goes to his cap and his brow and his hair just to let you know somethi might be coming. But, now, in addition to his slimy repertoire, he has a sidearm pitch that comes from down u it at the end of July; since then, he had won three of four starts before tonight.

For seven innings, Perrnner, Lowenstein, who walked in the second. With his big, slow curve and his sidearm delivery (no wet stuff today, Singleton said), he kept the Orioles off balance, lunging for balls that weren't there, popping up, frustrated.

Murray ruined the no-hitter with a single to center that led off the eighth. Soon the shutout was gone, too. The Oriolesleton singled to center and Joe Nolan doubled into the right field corner, scoring Murray. Pinch hitter Dwyer hit a smash to second. White made a lovely, lunging stop but Singleton scored anyway.

And it was enough to make Perry look his age. When the Orioles came to bat in the ninth, trailing, 4-2, they were facing Quisenberry, the man with the most saves (33) and the best ERA (1.68) in the league. In an underhanded way, Perry may have helped the Orioles. "He set it up for Quisenberry," said Ray Miller, the Orioles' pitching coach. "He was coming from the same place Quisenberry does but Quisenberry was throwing quicker. We were right on time for it."

After Bumbry led off with a single, Dan Ford and Ripken went out meekly. But on a 2-1 pitch, Murray sent an opposite-field bloop single to left center, scoring Bumbry. Lowenstein stood in and drove the ball toward first. John Wathan, the first baseman, dived and smothered it, then watched in dismay as it trickled toward the bag as Lowenstein crossed it.

Singleton lined the second pitch up the middle, scoring John Shelby, a pinch runner for Murray, with the tying run. Lenn Sakata singled into the gap in right center and Lowenstein scored the winning run.

It was Quisenberry's first loss since April 23. "I haven't done anything wrong for so long, I forget what it's like," he said. "I think I have the Midas touch, but apparently some nights I don't."