ST. PETERSBURG, Fla. (AP) -- Trey Mancini kept the Baltimore Orioles from beating themselves Wednesday night.
Mancini hit a go-ahead two-run double in the ninth inning, and the last-place Orioles beat the Tampa Bay Rays 5-4 despite committing five errors, their most in a game in more than 19 years.
It was the first time the Orioles committed five errors in a victory since June 9, 1983.
"I don't know the last time I've been part of a game that we've had five errors and won," Mancini said. "But baseball can be a very beautiful thing sometimes where maybe you make some mistakes, but maybe at the end of the day you still do enough to win the game."
Sergio Romo (2-3) allowed consecutive hits to Mark Trumbo, Danny Valencia and Mancini in the ninth, the only three batters he faced. It was Romo's seventh blown save.
"It just kind of happened, maybe location," Romo said. "I haven't seen the replay and I don't think I'm going to. I think I'll just chalk that one up to the baseball gods."
Tampa Bay has played five straight one-run games and lost four of them.
It was only the second time in 73 tries the Orioles won a game when trailing after eight innings.
"It's been a challenge for us," manager Buck Showalter said. "You just don't win major league games very often like that."
Mike Wright Jr. (3-0) got two outs in relief, and Mychal Givens pitched the ninth for his third save.
Carlos Gomez put Tampa Bay ahead 4-3 in the eighth with an RBI double off Wright. He also scored the tying run in the seventh on a sacrifice fly fielded by the shortstop.
Tim Beckham and Adam Jones homered on consecutive pitches in the first inning off opener Ryne Stanek. Trumbo led off the fourth with his 16th homer, extending his hitting streak to 10 games.
Baltimore starter Andrew Cashner gave up three runs and four hits in seven innings. Only one of the runs was earned.
After giving up three singles and two runs in the first inning, Cashner retired 18 of his next 19 before hitting Gomez with a pitch in the seventh. Kevin Kiermaier then bounced into an apparent forceout, but Beckham, playing shortstop, missed the base with his foot.
Willy Adames followed with a hit when Beckham lost his footing on a grounder to deep short, loading the bases. And after Beckham caught Michael Perez's flyball in short left field, Gomez tagged up. Beckham's throw was way off line, allowing Gomez to score.
"Cash was the difference tonight," Showalter said. "He didn't give up a hard-hit ball in the first inning and he gave up two runs, but he just kept pitching."
Stanek pitched two innings, giving up the homers to Beckham and Jones while striking out four. It was Beckham's sixth home run and Jones' 12th.
Orioles: Switch-hitting INF Steve Wilkerson (left oblique strain) still has some discomfort swinging from the left side and is not ready for a rehab assignment.
Rays: OF Tommy Pham (hairline right foot fracture) played catch and hit off a tee, and could return later this month. ... Reliever Chaz Roe (left knee) will start a rehab assignment Thursday night was Class A Charlotte.
RHP David Hess, who pitched 6 2/3 shutout innings against the Rays in his last victory on May 25, will pitch Thursday night's series finale for the Orioles against Rays opener Hunter Wood, probably followed by Yonny Chirinos.
More AP baseball: apnews.com/tag/MLBbaseball and twitter.com/AP--Sports