When you’re down so low sometimes the only direction is up. And for many of the nation’s worst-hit housing markets, home prices gained the most last year, according to the U.S. Federal Housing Finance Agency’s (FHFA) House Price Index for 2012.

The index, known as the HPI, is a weighted repeat-sales index that measures average price changes in repeat sales of mortgaged homes in state, regional or metro-area U.S. markets. It offers a snapshot of movements of the relative health of a local housing market over time.

For the most part, the biggest upswings in metro-area home prices last year were in markets that saw the hardest falls from the subprime mortgage meltdown of 2009.

Las Vegas, for example, is still digging out from a five-year HPI of 54.3 percent decline in home prices. But last-year prices recovered 4.5 percent, putting  Vegas high on the list of home-price gains in 2012.  

Here are the top metropolitan zones that saw the strongest growth in home prices in 2012:

Bismarck, North Dakota: 13%

Bismarck is the only metro area on this list that is experiencing growth in home prices due largely to factors other than post-recession housing market recovery, namely the boom from hydraulic fracturing of the nearby massive Bakken formation petroleum deposit. The Bismarck Tribune reported the average sale price of a single family home in Bismarck and its surrounding communities was $209,581, up from $181,063 in 2011. North Dakota’s economy outpaced every other state in the country in 2011, according to the Bloomberg Economic Evaluation of States index. That growth has continued.

Phoenix, Arizona: 12%

The metro area was battered by the sub-prime mortgage meltdown. Its five-year HPI stands deep in negative territory home prices down 38.4 percent), but last the metro area year saw a rebound as homebuyers sought out foreclosure deals. Arizona home prices shot up 20 percent last year, the biggest price gain in all 50 states, according to the Associated Press.

Boise City, Idaho: 8.3%

Boise-area foreclosures peaked in March 2010, but the worst appears to be over, albeit not without plenty of collateral damage, as reported recently by local online news provider StateImpact of Boise State Public Radio. The metro area’s five-year HPI number stands at -31.1, but last year saw a significant rebound.

San Jose, California: 6.9%

Home prices in this metro area are still down 20 percent from their pre-recession levels, but recent activity indicates a rebound is underway. Local Real estate agent David Contreras told the San Jose Mercury News in February that recovery is moving so fast one of his clients was going to sell her home at a loss for $160,000 but saw the value rise to above $235,000 in the past six months. San Jose’s average home price is $783,250, and ranks as one of the more expensive places to live in the country, comparable to nearby San Francisco.

Bakersfield, California: 6.1%

This metro area’s housing market is still in recovery mode, but there has been a recent uptick in homes sold for cash, a symptom of real estate speculation. Bakersfield home appraiser Gary Crabtree told the Bakersfield Californian that two out of every three foreclosed homes in the area are being sold to investors, and many of them are buying to rent to people who lost their homes. Like elsewhere, the recent rise in home prices is leading some to speculate that another real estate bubble is in play. The metro area’s five-year HPI number ended 2012 at -40.8.

Stockton, California: 6.1%

Like Bakersfield and other California metro areas battered by the last mortgage-driven economic meltdown Stockton home prices were pummeled. The area has seen home prices fall 44.7 percent in the past five years. But in January prices were up 12.4 percent year-over-year. Still more than half of the area’s homeowners are upside-down, which means they owe more than their homes are worth, according to local news provider Recordnet.com.

San Francisco: 6%

Bay Area home prices are on a robust rise with prices gaining 14.4 percent year-over-year in December. The metro area was second only to Phoenix in home price increases last year. Luxury home prices in this major market also increased 8.4 percent last year, according to San Francisco Business Times.

Merced, California: 5.9%

Homeowners here have received from respite from prices that have been pummeled over the years. But in 2012, prices rose 8 percent from the previous year. "Values in 2012 are certainly a lot closer to normal than values in 2005. However, I think the values in 2012 are extremely low. And I do believe we're seeing home prices pick up,” Jeff Michael, director of the business Forecasting Center at University of the Pacific, told the Merced Sun-Star.

Modesto, California: 5.4%

Like Bakersfield and Stockton, Modesto is one of the metro areas leading the nation in short sales, when homeowners sell at a loss. That’s “good news for buyers and investors in markets where short sales are closing more quickly at solid discounts," said Daren Blomquist, RealtyTrac vice president, according to the Sacramento Bee. "But buying from the bank may still be a better option in other markets." Home prices in the Modesto metro area lost 46.9 percent of their vales over the past five years.