It wasn’t such a merry end to 2011 for Brooklyn and Queens homeowners.

Fourth-quarter prices fell in both boroughs and sales activity slumped in Queens, as worries over the economy had buyers hitting the pause button.

“The market in Queens and Brooklyn is stable, but fragile,” said Michael Guerra, managing director of Brooklyn for Prudential Douglas Elliman.

The median price of a Brooklyn home dropped 4.3% from last year to $454,383. The number of transactions increased 6.1% to 1,558.

Prices in the borough were down in part because of a surge in sales of lower priced co-ops. Lured by rock bottom interest rates, buyers rushed to snap up homes in less expensive neighborhoods in south Brooklyn, such as Brighton Beach and Sheepshead Bay, and in east Brooklyn neighborhoods like Canarsie.

But prices fell far more in Queens, with the median price of a home in the fourth quarter dropping to $343,000, down 7% from a year ago.

Feeling the most pain were northeast Queens — which includes Bayside and Little Neck — and central Queens, which includes neighborhoods like Jamaica Estates. The median price of homes in both areas fell about 15%.

The number of home sales in Queens was down even more, falling 19.3%. A barrage of bad news about the economy spooked Queens homebuyers.

“There is a nervous quality in Queens that is bigger than the nervous quality in Brooklyn,” Guerra said.

But the luxury market in both boroughs has been relatively stable, with strong demand for pricey houses in Forest Hills Gardens, Queens, and for swanky Williamsburg condos and Park Slope brownstones in Brooklyn.

Overall, the Brooklyn market has been far less hurt by the economic downturn than Queens.

While Brooklyn prices dropped 18% after the recession hit, the blow to Queens was far greater, pushing housing prices down 30%.

“Brooklyn didn’t see the same depth of the correction,” said Jonathan Miller, CEO of Miller Samuel, which compiled the Prudential Douglas Elliman report.

Since hitting bottom, both boroughs have seen prices rise nominally.

“They have been skirting along the bottom,” Miller said.