Research In Motion had some welcome good news Thursday as shares surged 14 percent in after-hours trading on news of a smaller-than-expected loss for the second quarter.

Wall Street was bracing for more dismal results for the Canadian smartphone pioneer as the company copes with a drastically reshaped mobile market dominated by the "duopoly" of Apple's iOS and Google's Android operating system.

Could Have Been Worse

But the Waterloo, Ont.-based company, maker of BlackBerry phones and tablets, announced a net loss of 45 cents per share on a loss of $235 million, compared with a profit of $329 million in the same quarter last year, or 67 cents per share. Loss estimates had been as high as 47 cents per share.

CNBC said the loss was reduced to 27 cents per share when factoring in one-time restructuring costs. Shipments of 7.4 million smartphones and 130,000 PlayBook tablets were also better than expected.

Once synonymous with messaging on-the-go for everyone from politicians to executives and stockbrokers, RIM has seen its platform's global market share plunge to 5.2 percent in the second quarter compared with 11.7 percent in the same quarter of 2011, according to August numbers from Gartner.

ComScore estimated RIM's share of the important U.S. market at 10.7 percent in June, down sequentially from 12.3 percent in March of this year.

First-quarter results showed that RIM saw revenues drop 33 percent to $2.86 billion, with a net loss of $518 million. The company announced a restructuring that would result in the loss of 5,000 jobs as it struggles to get back on its feet. In January, RIM replaced CEOs Mike Lazaridis and Jim Basilie with German-born Thorsten Heins.

New Products Look Promising

While the company is not out of the woods by any means, it has high hopes for righting the ship once its new operating system and accompanying devices are announced early next year. To make the platform more enticing, RIM needs to build up its inventory of apps.

"They may not see a real positive upside until they ship BB10 devices," said wireless analyst Ken Dulaney of Gartner Research. "But they know this and have the finances to continue through this period. The new product looks promising so they have a shot at coming back to some degree. But the news won't be completely positive until then. At that point we can begin to discuss their rise as a phoenix or write their epitaph."

Heins tried to reassure developers and would-be developers earlier this week in San Jose, Calif., at the annual BlackBerry Jam developers conference that the platform was on its way back.

"We recognize the need for change," Heins said, according to The Associated Press. "There is a new energy and a lot of fighting spirit at RIM."

At that conference RIM also announced that an additional 2 million subscribers had signed up for its messaging services, for a total of 80 million.