InvenSense (NYSE:INVN) reported its third-quarter earnings on Thursday, beating analysts' expectations on both the top and bottom lines, posting revenue of $115.9 million and earnings per share of $0.21 on a non-GAAP basis. Analysts had expected revenue of $112 million and earnings of $0.20 per share.

Despite beating on the headline numbers, much of the focus seems to be on the company's gross margin results.

Source: InvenSense

Gross margin is still under pressure, but it's improving
In the company's second quarter, its gross margin came under pressure as it brought on Apple (NASDAQ:AAPL) as a customer and slowly ramped up production of its third-generation six-axis sensors for the iPhone 6 and iPhone 6 Plus, among other devices. Additionally, the company wrote down $7.4 million worth of inventory, taking about an 8% hit on gross margin. The total impact of these events was a drop in gross margin to 37%, well off the expectations of gross margin near 50%.

For the third quarter, InvenSense reported a gross margin of 46%, on the low end of the guidance of 46% to 47% that management had provided. The company wrote down $700,000 in obsolete inventory, which ended up reducing gross margin by approximately 0.6%.

The bigger impact came from the company's 10%-revenue customers, which receive InvenSense's best pricing. For the quarter, Apple alone accounted for 45% of InvenSense's revenue. Samsung accounted for 24%. InvenSense is seeing its customer concentration increase, which is putting pressure on pricing. In the second quarter, Apple and Samsung combined had accounted for 54% of total revenue.

InvenSense is currently facing potential class action lawsuits due to allegations that it failed to inform investors of the adverse affects its deal with Apple would have on gross margin. With the gross margin results dramatically improving this quarter, hopefully InvenSense will be able to put those allegations to bed.

It was widely expected that Apple would receive superior pricing due to its size, and that will continue to weigh on gross margin for some time. Investors should expect gross margins in the high 40%-range for the foreseeable future as Apple dominates its business.

Mixed guidance
InvenSense provided some good guidance for the current quarter during the earnings call. Its revenue is expected to come in between $95 million and $98 million, where analysts are currently modeling $92 million.

Gross margin is expected to remain flat, between 46% and 47%, which is far from the 50% long-term goal of the company, but in line with where the company guided near-term in the second quarter.

Again, management foresees margins remaining flat for the next two or three quarters. Analysts may have been expecting further improvement in gross margin, which was driving the stock price lower after hours.

The company's fourth-quarter EPS guidance is $0.12, right in line with current analyst expectations.

Most hated stock on Wall Street?
InvenSense beat analysts' expectations for the third quarter and guided for fourth-quarter results better than current analyst models. Still, the stock traded down as much as 12.5% after hours due to concerns over gross margin remaining in the mid-to-high 40% range for the foreseeable future. And there's not much upside beyond that in the near term.

However, analysts seem to be discounting its market share gains within manufacturers like Samsung and Xiaomi, which have led to excellent revenue growth in the last two quarters beyond the revenue impact of Apple. As I wrote earlier this month, "I'd rather own a company producing $100 million in revenue per quarter with a 45% gross margin than a company producing $60 million in revenue per quarter with a 55% gross margin."

For investors considering InvenSense, now might be the most opportune time to buy in.

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.