After years of poor cost performance, the profitability of Boeing's (NYSE:BA) troubled 787 Dreamliner program continued to improve last quarter. The 787 program's deferred production balance -- which approximately measures Boeing's accumulated losses from producing the Dreamliner -- fell by $316 million during Q1.

Still, the remaining deferred production balance of $27 billion represents a massive hole to climb out of. Boeing hopes to offset these accumulated losses with strong profits from the 787 program over the next five or six years.

One factor will be key to boosting the Dreamliner's profitability: an ongoing mix shift away from the barely profitable 787-8 toward the more lucrative 787-9 and 787-10 models.

A rendering of the Boeing 787-10

Boeing's 787-10 is more profitable to produce than its smaller siblings. Image source: Boeing.

The 787-8 falls out of favor

The 787-8 was the initial version of Boeing's Dreamliner, and it sold extremely well between the launch of the 787 program in 2004 and the beginning of deliveries in 2011. However, due to a poorly managed development process, the 787-8 ended up being much more expensive to produce than expected.

In fact, the 787-8 costs almost as much to build as the larger 787-9 model, but has a much lower selling price. Not surprisingly, Boeing has de-emphasized sales of the 787-8 in favor of the more profitable 787-9 and 787-10 variants.

Indeed, while the 787-8 has accounted for 60% of all 787 deliveries up until now, only 25% of Boeing's first-quarter Dreamliner deliveries were the 787-8 (eight out of 32). Looking ahead, 787-8 deliveries are set to slow even further.

The delivery mix is changing

As of the end of April, just 89 of Boeing's 672 unfilled Dreamliner orders were for the 787-8 variant. Seventeen of those are scheduled for delivery in the final eight months of 2017, based on analysis by Dreamliner production expert Uresh Sheth.

The Boeing 787-8 at its rollout ceremony

Deliveries of the 787-8 will fall off dramatically after 2017. Image source: Boeing.

This would leave just 72 787-8s on order. Even that total is probably exaggerated. For example, Aeroflot is responsible for 18 of those orders, but it plans to transfer its entire Dreamliner order book to a Russian aircraft leasing company. Aircraft leasing companies generally want to own the most popular aircraft models, since they have the deepest demand pool. Thus, these orders will probably be converted to the more popular 787-9 model.

Additionally, a number of Boeing's other 787-8 orders are shaky and may be canceled in the future, such as an order for 10 787-8s from the Iraqi government. The practical result is that in 2018 and beyond, the 787-8 could fall to less than 10% of the delivery mix.

Meanwhile, the 787-10 is on track to begin deliveries next year. Boeing has 149 firm orders for the 787-10, plus another pending order for 19 787-10s from Singapore Airlines. This is significant because the 787-10 has a list price more than $40 million above that of the 787-9, but doesn't cost much more to produce.

The decline of the 787-8 will drive profit growth

The 787-8 only accounted for 25% of Boeing's Dreamliner output last quarter, but that still represented a significant drag on the program's profitability. However, 787-8 production is on track to decline to a negligible amount over the next two to three years, while the 787-10 will reach at least 25% of the delivery mix during that time.

With the 787-10 selling at much higher prices than the 787-8, this mix shift alone could boost the Dreamliner program's annual profitability by $1.5 billion or more. Scheduled reductions in supplier pricing will also bolster the Dreamliner's profitability in the years ahead.

It's still likely to take a little longer than planned to offset all of Boeing's previous production losses for the 787 program. Nevertheless, Boeing is on the right track to reduce the deferred production balance significantly over the next five years or so.

Adam Levine-Weinberg owns shares of Boeing. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.