The state oil firm's technicians discovered one of the world's largest oil reserves deep beneath the seabed - under miles of layers of salt.
And then two years later, it struck gold again, finding yet another giant oil reserve.
Optimism was running high. The firm went to the markets and raised over $70bn - the world's largest share issue ever.
Brazil's economy was at cruising speed too, finally taking off after years of meagre growth.
But the good times did not last long - for neither the company nor the country. A massive corruption scandal last year eroded much of Petrobras's market value.
Brazil's economy too has been on a downward spiral - with high inflation, slow growth and low confidence.
So how did it all go so wrong, so fast?
Petrobras's oil bonanza and Brazil's emerging star status are fairly recent phenomena.
Just a few decades ago, prospects were dire for both.
In the early 1990s, Brazil was a young democracy in deep economic trouble.
Annualised inflation was running close to 5,000%. Decades of protectionism meant there was little competition in most sectors and many national firms had become inefficient.
Petrobras was seen as part of that landscape by many who wanted to privatise it.
One critic used to refer to it as "Petrossauro" - a large, outdated structure that moved slowly and was doomed to extinction in the modern world.
Brazil's fortunes started to change in the mid-1990s - both internally and externally.
Through reforms, successive governments were able to defeat hyperinflation, open up Brazil's economy to the world and redistribute growth, lifting millions out of poverty.
A decade of global economic boom favoured Brazil's champion exports - commodities like coffee, soya, beef and oil.
Brazil's oil sector was opened to foreign companies, but local laws made sure Petrobras kept its role at the top of every major project.
A decade of high international oil prices helped give a great boost to the firm's investment plans.
By 2010 - after all oil discoveries - it felt like Brazil and Petrobras had finally "arrived" at the top.
But then things took a turn for the worse.
One problem was Petrobras's desperate need for cash.
Brazil's treasure trove is buried deep below the pre-salt layer and can only be extracted with expensive methods.
President Dilma Rousseff was adamant that Petrobras should play a major role in all fields, although it did not have the resources to do it alone.
So the company sought to attract partners and raise money abroad by selling many of its assets.
Just as it was taking on its biggest financial challenge ever, Petrobras was hit by a recurrent obstacle in Brazil's history: corruption.
An investigation by Brazil's Federal Police revealed that the state oil giant was being used illegally as a cash cow for most parties in the government coalition.
Its top executives are all politically appointed by the government.
They allegedly handed out Petrobras contracts in exchange for party donations and bribes.
A string of high-profile arrests were made - from top Brazilian CEOs to the treasurer of Rousseff's ruling party.
More than 40 key politicians are under investigation, including the presidents of both houses of Congress.
Confidence in the company eroded almost overnight - both in the markets and in the streets.
Its own CEO was sacked for not being able to handle the crisis.
Tens of thousands of Brazilians took to the streets against President Rousseff - who chaired the board of Petrobras for much of the period when the alleged bribes happened.
It could not have come at a worse time for Brazil's economy.
It is stuck in low gear, now that the commodity boom seems to be over, and its goods are no longer in high demand.
Until last year, the government had been trying to navigate through the crisis by raising spending and pumping money into the economy.
The pre-salt layer is made up of rock that was laid down millions of years ago before a layer of salt - which can be thousands of metres thick - accumulated above it.
Some of the oil formed in the pre-salt layer has not leaked up into the layers above.
This oil is often of good quality, but is buried so deep that access to it is difficult.
According to Petrobras, there may be 50 billion barrels of oil in the pre-salt layer found in the Brazilian continental shelf.
Petrobras itself was used as an instrument of that policy.
The state oil firm controls the internal price of fuel, and for three years it helped Brazilians get cheaper petrol.
But the subsidies hurt the company at a time when it needed all the cash it could get for its pre-salt project.
Now the government has done a u-turn in its policy, going radically from stimulus to austerity.
In the past, Petrobras has helped the government get through downturns, as its investments alone represent 2% of Brazilian Gross National Product.
But now it is making matters even worse.
One study by FGV Business School suggests the fall of Petrobras investment could knock about $30bn off the Brazilian economy, with more than a million jobs lost, mostly in construction.
Petrobras and Brazil have been trying to react to the crisis with a push for transparency.
Later this month, it will replace some politicians in its board of directors with respected market figures, like the president of mining giant Vale, Murilo Ferreira.
The energy minister has even signalled that the government might ease access to pre-salt projects for foreign firms, reducing the burden on Petrobras.
Some say Brazil has learned some lessons.
"If you concentrate everything - all wealth - in a single company controlled by the state then it is very easy for the political system to go there and try to grab resources,", says Sergio Lazzarini, an academic at Insper Business School.
"You can avoid this with more competition, more transparency, more regulation."
Brazil and Petrobras still have a difficult path to follow.
Most economists predict Brazil will be in recession this year.
And the corruption scandal is far from over, as no-one has been tried yet.
President Rousseff insists Brazil and Petrobras will be stronger after this crisis, as historic corruption is finally being investigated after decades of omission.
Brazilians hope she is right, but the mood in the country is bleak.
After decades of low expectations, Brazilians had come to think in recent years that the nation was finally emerging into the world stage as a global power, only to see it again stuck with corruption and low growth.
While many still recognise the country is much better off than in the years of hyperinflation and "Petrossauro", optimism has now been largely replaced by scepticism and impatience.
Brazil's treasure trove, it seems, will take a while longer to dig out.
In 2008, Petrobras and its main stakeholder - the government of Brazil - hit the jackpot.