The Baltimore Orioles, who have been in need of a pick-me-up lately, nearly wasted one tonight.

Dennis Martinez pitched eight strong innings and Cal Ripken Jr. made a daring steal of home as the Orioles seemed to have a safe 8-3 lead going into the ninth inning against Texas. But the Rangers scored four runs, hitting two homers off Tim Stoddard, before Tippy Martinez came in to get the last two outs and secure an 8-7 victory before 13,344 at Memorial Stadium.

Dennis Martinez (5-4) pitched well, although he was worried about his 7-year-old daughter, Erica. She had been hit by an automobile early today, but was released from the hospital. Martinez was replaced with an 8-3 lead and two men on in the ninth inning, giving way to the struggling Stoddard. He left the stadium right after that.

Stoddard, whose recent slump has been at the heart of the Orioles' bullpen problems, got only one man out. He gave up a single, a three-run homer to pinch hitter Leon Roberts and a home run to Lamar Johnson.

Tippy Martinez, who has shared the blame for the Orioles' recent inability to hold on to late-inning leads (the Orioles are 3-9 in one-run games), improved on his 5.56 ERA by getting Randy Bass, the cleanup hitter, to fly to left and John Grubb to strike out.

In the early going it appeared that Dennis Martinez, who has been knocked out before the fourth inning three times this year, would not be able to shake his personal problems and get to even the middle innings.

His early nervousness brought Manager Earl Weaver out of the dugout for a talk in the third inning. But after allowing three runs and seven hits in the first four innings, Martinez settled down and allowed two hits and no runs until the ninth.

"I don't know what settled him down," Weaver said. "For three innings he struggled, but he seems to have some of his best games when he does that."

"Do you know his daughter was hit by a car today? Do you know he saw it happen?" asked Ray Miller, the pitching coach. "Do you know he didn't know she was all right until the umpire went out and told him before the first pitch? Don't say anything about courage when a guy handles that."

Though the Orioles had won eight of 12 games before tonight, they had dropped to sixth place, two games below .500, after losing the last two games of a weekend series to Toronto. They needed a boost.

Ripken provided it in the sixth inning when he stole home to put the Orioles on top, 4-3. With two outs and two strikes on Al Bumbry, Ripken took off as soon as catcher Jim Sundberg tossed the ball back to pitcher Jon Matlack. Ripken beat Matlack's return throw with a half-slide and managed to slip under Sundberg's high tag. Lenn Sakata, who moved to second on the play, then scored on Bumbry's single.

The lead seemed safe, especially after Rich Dauer singled home one run and Ken Singleton hit a two-run homer in the eighth for an 8-3 lead.

"It's just a normal play, the kind of thing we look for all the time," said Ripken, who also doubled, singled and walked twice.

"But I'm sure it helped liven us up and give us a little spark, which we really needed. We know we can't make up for our earlier problems by winning 10 games in a row, but we have to keep making up ground."