On July 28, the Orioles lost to the Oakland Athletics to drop their record to 52-49.

As pleasant a surprise as the club had been to that point, the season suddenly carried all the hallmarks of an Oriole collapse, the kind fans had come to expect in 14 straight years of losing.

The Orioles had given up far more runs than they had scored. The defense was suspect. Injuries had frayed an already patched-together roster.

But executive vice president of baseball operations Dan Duquette and manager Buck Showalter did not simply watch the train derail. They executed a series of moves — none of which seemed transformative at the time — that made the Orioles a different and far better team in August and September.

They jumped 20-year-old Manny Machado from Double-A to the big leagues. They signed Nate McLouth, a former All-Star scorned by two other teams, and plugged him into left field. They made Nick Markakis — once projected to be a slugger — their leadoff hitter. They repurposed struggling young starters into deadly middle relievers.

This refusal to sit still permeated the organization. If a player could not do his job in the majors, he would be sent to Triple-A to find a more effective role. Meanwhile, another player who had performed well in the minors would be given an opportunity — a real chance to play — in Baltimore.

"The one thing that we can offer that some clubs can't is opportunity," Showalter said. "Now, I think when we talk to people in the offseason about coming with us, regardless of their track record or status in the game, they know that this is a team that's going to give opportunity regardless of your background. If you play well, we'll keep you."

Since that loss to Oakland, the Orioles have gone 41-20 and outscored opponents by 70 runs. They have played not like a fluke but like one of the very best teams in baseball.

"I think the Orioles are a great example of how a well-constructed, middle-market team rises to the postseason," said Cleveland Indians team president Mark Shapiro. "It's a combination of well-executed draft picks, impactful trades and then those creative touches that it takes to finish out the picture."

It's tempting to view the 2012 Orioles as the Hollywood-crafted Indians of "Major League," sprung improbably to life. But the reality is more complicated.

Duquette's predecessor, Andy MacPhail, left after the 2011 season, widely regarded as another in a string of executive failures. But MacPhail deserves substantial credit for building this year's team.

His regime drafted and signed Machado and signed stalwart catcher Matt Wieters. MacPhail showed a particularly deft hand at trading for everyday players, acquiring Adam Jones J.J. Hardy, Chris Davis and Mark Reynolds for a collection of middle relievers, second-tier prospects and oft-injured starter Erik Bedard. MacPhail, in conjunction with owner Peter Angelos, also hired Showalter.

"I'd say what was there as a core was pretty good," said former Toronto Blue Jays general manager J.P. Ricciardi. "They had a really good pillar behind the plate, a good shortstop, a really good centerfielder. Davis and Reynolds have power."

Duquette had a similar view of what he inherited.

"This team had a number of core players, every-day position players, that were good players," he said. "They were just looking for some hope, and we needed to go to work on building a pitching staff. That's where we spent most of our energy."

A global search for pitching

MacPhail had tried to build his rotation through the draft, figuring that if he picked enough talented arms, some of them would have to pan out. But the Orioles were unlucky in that respect. Highly touted prospects Brian Matusz, Chris Tillman, Jake Arrieta and Zach Britton all pitched well in flashes, but none established himself as a first-rate starter by the end of MacPhail's tenure.

Many analysts thought the 2012 team's fortunes would also rise or fall on the arms of that quartet. But Duquette and his scouts scoured the globe for pitchers who could step in if the flashier names faltered. Fellow executives praise Duquette for his attention to detail — "Dan is tirelessly focused on the game to an almost obsessive level," Shapiro said — and nowhere did that show more clearly than in the pitching hunt.

While other clubs scrambled to spend tens of millions of dollars in bidding for Japanese sensation Yu Darvish, the Orioles snapped up Wei-Yin Chen, a Taiwanese lefty whom they had scouted for several years. Chen has given them 192 2/3 solid innings for the modest cost of $3 million.

Even more obscure was Miguel Gonzalez, plucked from the Mexican League on the recommendation of new scout Fred Ferreira. Gonzalez had failed to reach the majors in seven seasons with Los Angeles Angels and Boston Red Sox and was barely an afterthought in the Orioles' plans entering the season. Now he's 9-4 and has been arguably the club's best starter in the second half of the season.