Software-as-a-service (SaaS) stocks had an atrocious 2022. Unfortunately, much of that was self-inflicted, especially considering the lofty valuations many stocks reached during their late 2021 peaks. Now that the mass exodus out of these companies has likely run its course, long-term investors can sift through the rubble to find some companies worth owning.

One stock set for a strong recovery in 2023 is Twilio (TWLO 1.08%). It's down nearly 90% from its high, but I'm not investing in it because it can notch a new high soon. Instead, it's a smart investment, because it still has the potential for outsized returns in the future. Read on to find out why.

Twilio doesn't need to set a new all-time high to be an excellent investment

When a stock is down 88%, it must increase by 733% to return to its breakeven point. That's a tall order, and it could take many years to accomplish that feat. Of course, it may never reach that previous peak again -- just look at Cisco Systems' stock chart dating back to the dot-com bubble.

CSCO Chart

Data by YCharts.

However, given the broad market's historical annual return of about 10%, Twilio could need 20 years to set a new all-time high, and it would still outperform the market.

So let's ignore how Twilio's stock traded in 2021 and 2022, and let's focus on the present and future.

Twilio is a communication company that helps businesses maintain contact with their clients. If you've ever received a text from a doctor's office or auto shop to confirm an appointment, then you've likely interacted with Twilio's product. However, that's just the beginning of what Twilio can do.

It also can link customer data to metrics to reduce customer acquisition costs. For example, Domino's Pizza utilized Twilio Segment to reduce customer acquisition costs by 65%.

With its ability to integrate with video messaging, emails, or programmable voice, Twilio can turn small and large businesses into customer satisfaction machines.

But the business model and idea aren't the problems with the stock -- it's the financials.

Twilio's lack of profits is under the microscope

In Twilio's nearly eight years as a public company, it hasn't produced a dollar in profits under generally accepted accounting principles (GAAP). To make matters worse, Twilio's profit margin has also rapidly trended in the wrong direction.

TWLO Profit Margin Chart

Data by YCharts.

A negative 36% trailing-12-month net profit margin isn't an easy thing to dig out from, but that's what Twilio must do. The first step was cutting some of its expenses, which Twilio did in September when it laid off 11% of its workers.

Another item that disappointed investors was its revenue forecast. In 2021's fourth quarter, CEO and co-founder Jeff Lawson discussed his vision for Twilio to deliver at least 30% organic revenue growth through 2024 and to achieve non-GAAP (adjusted) operating profitability in 2023. However, in the third quarter of last year, management revoked that top-line guidance while keeping the non-GAAP operating profitability on the table.

This concerned many investors, because it will be substantially harder to become profitable if there isn't revenue growth to drive it. The result of that uncertainty is a much lower stock price -- and more affordable valuation.

TWLO PS Ratio Chart

Data by YCharts.

Quite frankly, this valuation reflects a company that investors are far less confident will succeed and outperform the broad market. However, I think this is misguided.

First, Twilio is still guiding for 29% full-year revenue growth in 2022. Additionally, it's still signing on new customers (approximately 5,000 of them in the third quarter alone), and existing customers spent $122 for every $100 they spent in the prior-year period. So Twilio still has plenty of growth left, and it's adjusting properly to ensure its profitability plans line up with the current environment's growth rate.

Investors will learn a lot more about 2023's outlook when it reports fourth-quarter and full-year results on Feb. 15. In the meantime, investors should consider initiating a small position in the stock, as there's limited downside, especially considering Twilio's net cash position represents about 35% of its market cap.

The climb back to its all-time high will be a long one for Twilio, but the company is still operating from a position of relative strength. Couple that with its attractive valuation, and Twilio could deliver an impressive rebound in 2023.