The Tigers erased a three-run deficit in the ninth before claiming one-run leads on an 11th-inning single by Alex Avila and a 13th inning single by Quintin Berry.
But Jose Valverde blew the save in the 11th before Joaquin Benoit blew his own save chance, taking a loss in the 13th.
"I don't know if I've been a part of one that's as crazy as that," said Tigers starter Max Scherzer, who struggled controlling his fastball and allowed four runs on nine hits in five innings.
"I've never been in a game where it's back and forth, back and forth for so many innings," Berry said. "Usually you go into extras, it's nobody can score. This one, we were all scoring. Like I said, you can't ask for anything more on either side. We battled as well as we could."
Staked to a 6-5 lead, Benoit entered in the bottom of the 13th and gave up three runs, snapping the Tigers' six-game winning streak.
With one out, J.J. Hardy smacked a towering homer into the stands in left to tie the game, breaking his personal 0-for-28 slump. Benoit then struck out Jim Thome for the inning's second out, setting the stage for Teagarden.
After sitting out the entire season with a back injury sustained in Spring Training, being called up just prior to Saturday's game and entering as a defensive substitution in the 11th, Teagarden blasted a two-run shot to right just over the glove of a leaping Don Kelly to seal the O's win.
"I never thought I would see this day," Teagarden said. "It has been somewhat of a grind for me this year, just being in this clubhouse and amongst these guys, it means the world right now."
Approached by reporters after the game, Benoit said, "Not today."
"I feel confident with Benoit against anybody," Leyland said. "And Valverde the same. I feel confident with those guys no matter what."
Many times before Teagarden's theatrics, the afternoon start that wore on until long after sunset appeared to be decided, only to have the trailing team fight back at every turn.
With one out and the score tied in the top of the 13th, Danny Worth, who entered in the ninth as a pinch runner, doubled down the third-base line, moved to third on a wild pitch and scored easily on Berry's first-pitch single against Matt Lindstrom to give the Tigers a 6-5 lead.
The Tigers broke another tie in the 11th. Prince Fielder and Delmon Young led off with back-to-back singles before a pair of fielder's choices put runners on first and third with two outs for Alex Avila. The O's brought in lefty Troy Patton to try to escape the jam, but Avila blooped a 1-2 slider to center to score Young and give Detroit a 5-4 lead.
But, in each case, the Tigers bullpen coughed up the lead.
"I would've liked to come out on the other side," Avila said, "but it was a lot of fun."
Handed a 5-4 lead in the bottom of the 11th, Valverde gave the Orioles life by yielding a one-out double to Nick Markakis. After Hardy struck out for the second out of the inning, Valverde fell behind Thome 3-0 before giving him the intentional pass.
Adam Jones was up next and hit a fastball into left field, scoring Markakis from second to tie the game.
"We got a lot of big hits," Leyland said. "Today we just didn't hold them, it's that simple."
The Tigers were lucky to even see the 11th after trailing by three runs heading into the ninth. But, against All-Star closer Jim Johnson, the Tigers knocked as many hits as they had in the previous eight innings combined to score three runs and tie the game at 4.
Miguel Cabrera led off with a single before Young reached on an error by third baseman Ryan Flaherty. Jhonny Peralta knocked an RBI single up the middle and Brennan Boesch doubled into the right-field corner, scoring Young and putting runners on second and third with one out.
Berry followed with a line-drive single to left to score Worth from third. As Boesch rounded third to try to give the Tigers the lead, O's defensive replacement Endy Chavez threw home, beating Boesch to the plate by a wide margin to preserve the tie.
"There were so many great things that went on in that game," Orioles manager Buck Showalter said. "That was a scratch and claw game. I wouldn't know where to start."
Prior to the late inning drama, the Tigers had struggled to get anything going.
Austin Jackson led off the game with a walk and scored when Fielder drove a double to the gap in left-center, but that was all the scoring the Tigers could muster against O's starter Wei-Yin Chen.
The left-hander from Taiwan retired 15 in a row after Fielder's double, finishing the game with only one run allowed on two hits and two walks in six innings, setting up the late inning drama.
"We battled our [behind] off," Leyland said. "We got beat, we came up short. You tip your hat to them. They battled just as hard as we did. They got one more big hit than we did."