Tesla stock closed Wednesday up 9.7 percent at $319.50 per share, meaning investors who sold the stock short lost a collective $1.07 billion in a single day, estimates S3. Tesla bears have lost nearly $5 billion in mark-to-market losses since 2016, S3's head of predictive analytics Ihor Dusaniwsky told CNBC.

Investors betting against Tesla lost more than $1 billion Wednesday as the company's shares rallied the most in over two years, according to estimates from financial technology firm S3 Partners.

Source: Ihor Dusaniwsky, Head of Predictive Analytics at S3 Partners

Chairman and CEO Elon Musk got a vote of confidence from shareholders at the company's annual meeting Tuesday. Musk also told shareholders it is "extremely likely" Tesla will hit a weekly Model 3 production rate of 5,000 cars by the end of the month. Tesla has been struggling with production issues and faces concerns about its finances.

Tesla is the most heavily shorted stock in the U.S., as well as the most heavily shorted automaker in the world. Short interest, or the number of shares borrowed in hopes of buying them back at a profit after the stock drops, totals $9.03 billion for Tesla, according to S3. That's about $1.6 billion larger than second-place Amazon's short interest.

Source: Ihor Dusaniwsky, Head of Predictive Analytics at S3 Partners

"Shorts are actually covering slightly since the beginning of last month," Dusaniwsky said.

Shorting Tesla is costing investors "over $1 million in financing a day to keep up," Dusaniwsky added, as the fee investors pay to bet against the stock is at about 3.5 percent. At the beginning of this year, that fee was only about 1 percent, according to Dusaniwsky. By April the short fee had jumped, hitting 3 percent and higher, he said.

— CNBC's Tom Franck contributed to this report.