What could go wrong did go wrong for the Orioles tonight, and after three straight crushing losses to the mediocre Cleveland Indians they could have abandoned hope.

But instead, according to rookie Cal Ripken Jr., there was rare spirit and intensity in the dugout as Baltimore rallied from a 4-1 deficit to score a 5-4 victory over Detroit before a Tiger Stadium crowd of 26,477 and take third place in the American League East away from the Tigers.

Eddie Murray hit a three-run homer off struggling Jack Morris to tie the game in the fifth inning, and Ripken's soaring high fly off reliever Pat Underwood landed in the upper deck in left field in the sixth for his ninth homer and the game-winner.

Said Ripken, "I had the privilege of facing him (lefty Underwood) before. When the count went to 2-1 I started looking for something slow. He threw me a change up. When you're looking for something slow and you get it . . . "

Ripken simply smiled.

These were today's pleasant memories. For awhile it looked as if there might not be any.

The Orioles' woes began when their bus broke down en route from the airport for an hour's delay. Then, with a 1-0 lead in the third inning, the bottom fell out as Floyd Rayford committed two horrendous errors at third and the Tigers went ahead, 2-1.

Rayford backhanded Lou Whitaker's leadoff bunt down the third base line but threw it high and wide beyond Murray at first base. It rolled all the way to the bullpen and Whitaker was on third with a base hit and a two-base error.

The next batter, Tom Brookens, sent a line shot at Rayford that bounced off the heel of the harried third baseman's glove for error No. 2, Whitaker holding at third.

A single and a sacrifice fly scored the two runs.

In the next inning, Oriole starter Jim Palmer gave up a leadoff single to Larry Herndon and Lance Parrish followed with a crashing drive into the left field upper deck to make it 4-1.

To make matters worse, Palmer, who had won four straight and was 5-1 since returning to the starting rotation May 25, complained between innings of soreness in his elbow.

But, said Ripken, the chatter never died in the dugout, faith was not lost and no one was surprised when, after Morris walked the first two batters in the Oriole fifth, Murray pounded his 11th homer of the year into the upper deck in right. It was a hard-hit ball, still rising when it crashed into the vacant seats in the 10th row.

Palmer went back out and retired the Tigers in order in the fifth, and he became the pitcher of record when Ripken sent his two-out homer aloft in the Oriole sixth.

But Palmer's elbow was "twitching" between innings, said the pitching coach, Ray Miller, and he gave way to relief help. The help was good enough to earn Palmer his seventh win against three losses, and his 255th lifetime victory.

Tippy Martinez stopped the Tigers on two hits and a walk over two innings and Tim Stoddard struck out the first four batters to face him, then walked a man and retired the last two Tiger batters on pop flies to earn the save.

There was no word on the severity of Palmer's sore arm. "We'll have to wait and see," said Miller.

Said Manager Earl Weaver, who juggled his lineup dramatically tonight in an effort to shake the losing string, "I think they wanted to win it for Rayf (Rayford). He's a helluva guy and a helluva ballplayer and he doesn't get to show it much."

Weaver had Jim Dwyer leading off for the first time since minor league, Ripken at shortstop instead of his customary third, designated hitter Ken Singleton batting sixth, and Rich Dauer batting ninth.

Weaver gloated that even despite the three-game collapse with the Indians, the Orioles have won 16 of their last 24 and are within striking distance of the first-place Boston Red Sox.

"I'll take four games back in the loss column at the All-Star break," said the manager, looking ahead to next week. "And I'd take 16 wins in the the next 24, even if it includes another three-game losing streak."

The loss went to Underwood (3-5), but the worse news for the Tigers was Morris' dull outing. Once the anchor of the Tiger staff, he has lasted just 16 innings in his last five appearances. He was 1-5 in June. Pitching coach Roger Craig said he and Morris had determined that the right-hander had a mechanical problem--"He's slinging the ball instead of throwing it."