InvenSense (INVN) reported its third-quarter earnings earlier this week, missing consensus estimates on the top and bottom lines. A weak outlook for the company's fourth quarter had analysts selling shares, driving the stock down over 7% at one point, in after-market trading.

The company is winning market share at Samsung (NASDAQOTH: SSNLF) over its largest competitor STMicroelectronics (STM 1.09%), and the Korean-electronics maker accounts for about one-third of InvenSense's revenue. Weakness at Samsung, or any one of its biggest customers, could negatively impact InvenSense quarter-to-quarter, but its earnings report should give long-term investors confidence.

But first, the bad parts
I'd be remiss if I ignored a few details from InvenSense's earnings report that caused analysts to sell the stock after hours on Wednesday.

Not only did the company miss consensus estimates for non-GAAP EPS, it missed its own guidance from the second quarter of $0.16 to $0.18 per share. Moreover, it completely missed its forecast for GAAP EPS of $0.10 to $0.11 when it reported breakeven profits. Increased operating expenses as the company increased its inventory and ongoing litigation expenses with STMicroelectronics -- which were higher than anticipated -- led to the lack of profits.

STMicroelectronics patent portfolio of over 900 MEMS-related patents is one of the company's biggest strengths, so it aggressively defends those patents. Legal fees related to litigation rose to $3.5 million last quarter for InvenSense, and the company expects fees to be between $3 million and $5 million in the current quarter.

Additionally, the company's gross margin remains relatively low at 51%. It was 54% in the year-ago period. The company expects long-term, gross margin to climb to the mid-50% range as customers transition to its newest products. Its biggest customers, however, get the best pricing, and with Samsung climbing to one-third of sales in recent quarters, it has weighed on InvenSense's gross margin.

Going forward, the company expects revenue of $55 million to $58 million in the fourth quarter, below analyst's expectations of $62.8 million. Meanwhile, analysts were expecting non-GAAP EPS of $0.15, significantly higher than management's guidance of $0.09 to $0.11. Gross margin should be in-line with its previous quarter, but still below its long-term target.

The long-term outlook is strong
Despite the company's short-term struggles and weak outlook for the upcoming quarter, it relayed a very positive outlook for fiscal 2015 beginning in April. The company expects growth of 25% to 35% on its top line. Analysts had been expecting growth to fall below 23%. In the first nine months of fiscal 2014, the company has increased revenue 26%, but that's expected to come down based on its fourth quarter outlook.

Long-term growth should be bolstered by an increased share in Samsung design wins. The company has grown its share at the largest smartphone manufacturer from 30% to greater than 50% in the last 7 quarters. It's taking share from STMicroelectronics. With the upcoming release of the Galaxy S5, InvenSense should see Samsung continue to drive revenue growth within the company, but it will put pressure on its gross margin.

Another surprise from the company's earnings report was the disclosure of Xiaomi as it contributed 16% of revenue in the third quarter. Xiaomi has been tremendously successful in its home country, China, where it outsold Samsung (and everyone else) in December. The company has plans to expand its operation to more developing countries, which means further opportunity for InvenSense as it ties itself to another growing company.

InvenSense sees China as a big opportunity going forward, and believes its possible other Chinese manufacturers could cross the threshold to become disclosable (10% of revenue).

Additionally, the company's OIS technology continues to be an opportunity for growth, but it should begin feeling pricing pressure from STMicroelectronics as the competitor has caught up with a good-enough design and better pricing. This isn't anything new for InvenSense, and it should deal with the pricing pressure just fine as it targets high-end customers and wearables.

Buying or selling?
Post-earnings, InvenSense's stock price has been all over the map as short-term sellers sent shares to long-term investors. By the close on Thursday shares had climbed over 4% from Wednesday's close, and 12% from the bottom of Wednesday's after-market trading. The long-term outlook for InvenSense should encourage Foolish investors to buy into the stock despite some near-term uncertainty and volatility.