If you bought shares of BlackBerry (NYSE:BB) (NYSE:BB) ten years ago, you'd be sitting on a 90% loss due to the death of the company's smartphone business. But if you bought BlackBerry at the beginning of 2017, you'd have a 65% gain thanks to the growth of its software and patent licensing businesses.

Therefore, investors might be wondering if BlackBerry's recovery is real this time, or if it's another head fake that will punish overeager bulls. Let's take a closer look at the bull and bear cases to find out.

A businessman researches an investment.

Image source: Getty Images.

The bull case for BlackBerry

At first glance, BlackBerry's ongoing streak of double-digit revenue declines looks bleak. However, its 29% annual sales decline last quarter actually marked its slowest rate of decline in four quarters. Analysts still expect BlackBerry's revenue to fall 32% this year, but to dip just 2% next year.

But more importantly, BlackBerry posted sequentially higher non-GAAP profits for four straight quarters. Its earnings of $0.05 per share last quarter easily beat estimates for break-even earnings, and its adjusted EBITDA remained positive for the 14th straight quarter. It also reported a record non-GAAP gross margin of 74%, compared to 67% in the previous quarter and 62% a year ago.

Analysts expect its non-GAAP EPS to rise 17% this year and another 14% next year. Therefore, the stock looks surprisingly cheap at 12 times earnings, which is much lower than the industry average P/E of 33 for communication equipment makers. BlackBerry also expects its free cash flow to turn positive this year.

A smart transition toward software

That stunning turnaround is widely attributed to CEO John Chen's decision to pivot from self-produced smartphones toward higher-margin enterprise software solutions. Last quarter, its software and services revenue rose 34% annually on a GAAP basis and accounted for 79% of its top line, compared to just 41% in the prior year quarter.

BlackBerry took 3,300 enterprise orders during the quarter, up from 3,000 orders in the first quarter. Big wins during the quarter include the certification of an end-to-end solution for encrypted calls and texts for the US and Canadian governments and a deal with Delphi (NYSE:DLPH) to use QNX as the OS for its autonomous driving platform.

It also achieved Gartner's highest scores in its assessment of high-security mobile management platforms for the second straight year -- making it a "best in breed" security play for a world filled with vulnerable devices.

The bear case against BlackBerry

BlackBerry's headline numbers look great, but the bears will note that its earnings beat last quarter was mostly attributed to two non-recurring gains in its older SAF (system access fees) and newer IP licensing businesses.

During the first quarter, BlackBerry guided for a 25% sequential decline in SAF revenues for the second quarter, but they eventually fell just 2%. That softer drop was caused by a one-time collection of $9 million in overdue SAF fees. Meanwhile, IP licensing revenues rose $24 million sequentially, but CEO John Chen admitted during the conference call that an unspecified bulk of that gain came from non-recurring "upfront" fees.

When we consider that BlackBerry's revenue beat analyst estimates by $29 million last quarter, it seems that it would have missed expectations without those one-time gains. But that's not all -- BlackBerry's free cash flow for this year would actually be negative if we exclude the one-time payment of $940 million from Qualcomm (NASDAQ:QCOM) in a patent violation dispute which was settled in May. That ruling found that BlackBerry overpaid Qualcomm royalty fees between 2010 and 2015.

Despite all those one-time gains, BlackBerry remains unprofitable on a GAAP basis. However, its loss of $0.07 per share last quarter still marks a significant improvement from its loss of $0.71 per share in the prior year quarter.

Lastly, the bears will note that two key leaders of the IP licensing business recently left BlackBerry -- which casts a shadow over the future of its fastest growing business.

So is it safe to buy BlackBerry?

I think John Chen has done an admirable job turning BlackBerry around, and demand for its best in breed enterprise security software should continue rising with the recent surge in data breaches.

The company's dependence on non-recurring items to boost its revenue growth is noteworthy, but the stand-alone growth of its software and services revenue (which excludes IP licensing and professional services revenue) indicates that the turnaround is sustainable. Therefore, I believe that it's safe to start a small position in BlackBerry today, even though it's a highly speculative play in a frothy market.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.