Updated from 9:30 a.m. EDT

Investors piled into U.S. auto stocks on Thursday as successful contract negotiations with the United Auto Workers union sparked a wave of optimism about Detroit's prospects on Wall Street.

Shares of General Motors ( GM) broke the $40-mark for the first time in three years before pulling back slightly. Shares were up $1.85, or 4.9%, to $39.98.

Ford ( F) were also rallying, up 39 cents, or 4.7%, to $8.62.

Is this wave a sign of the tide turning for the beleaguered U.S. automakers, or is it bound to crash into the rocky shoals of continued sales declines in North America?

"A whole lot of optimism built up in September around these labor negotiations, and now that they're wrapping up with these agreements, we're seeing the result in these stock moves," says Calyon Securities analyst Mark Warnsman. "I'm not convinced that the adverse fundamentals have really changed. They still have to make better cars that people will buy."

The stocks' move came after Chrysler, which was recently taken private by Cerberus Capital Management, announced that it reached a tentative agreement on a new four-year labor contract with the UAW. The deal ended a six-hour labor strike against the company.

GM reached its own agreement with the union two weeks ago after a two-day strike, and its UAW workers voted in favor of ratifying the agreement on Wednesday, with 60% of the votes cast in support.

The pact will set up a union-controlled health care trust fund, freeing GM from roughly $51 billion in health care liabilities for retirees in return for a large upfront cash payment. It sets up a two-tier wage structure, allowing GM to pay new-hires lower wages and benefits than existing works, and it also includes guarantees for the production of certain vehicles in the U.S., providing job security for workers.

In a report, Citigroup analyst Itay Michaeli raised his target price on GM shares to $46 and lowered his risk profile to "high" from "speculative," citing "GM's improving business and free cash flow profile."

Media reports indicate that Chrysler's agreement follows a similar framework as GM's, and more details are expected to emerge as the union promotes to deal to its members. A spokesman for Chrysler declined to discuss the details of its agreement, and a spokesman for the UAW could not be reached.

Talks now are expected to shift to Ford ( F), which is last in line at the bargaining table. Ford spokeswoman Marcy Evans says the company has not yet begun negotiations with the UAW.

For its part, Ford has long been considered Detroit's laggard in the U.S. auto industry's efforts to revive itself. It was well behind GM in adopting a sweeping restructuring plan aimed at reducing its footprint in North America to match its shrinking market share. And while GM has shown an uptick in U.S. sales in recent months, Ford's have continued to decline.

Given the weakness in its business and its position as the last of Detroit's Big Three automakers at the negotiating table, Ford is expected to be the UAW's toughest bargaining partner.

E.K. Riley Investments analyst Robert Toomey says he is "vastly more optimistic" on GM and Ford now that labor negotiations are winding down.

"We're seeing that labor understands the seriousness of the problem for these companies," says Toomey, who discloses that he owns shares of GM. "Their long-term prospects are improved significantly by getting out from under the retiree health care liabilties."

Warnsman, whose firm has recently had a banking relationship with GM and Ford, is more skeptical.

"These negotiations are not a huge win for these companies," he says. "In a turnaround, you need cash, and these labor agreements promise to squeeze a lot of cash out of GM and Ford. You're essentially taking unfunded liabilities and forcing them to fund them, and that reduces their flexibility.

"They're moving in the right direction, but they're not moving fast enough, and if we're heading towards an economic downturn with this mess in the housing market, that could be very tough for these automakers," he adds.

More from Stocks

Tech Stock Predictions for 2019

Tech Stock Predictions for 2019

Nutrisystem Soars on Deal to Be Acquired by Tivity Health

Nutrisystem Soars on Deal to Be Acquired by Tivity Health

Jim Cramer Says That This Is a Question All Investors Must Ask Themselves

Jim Cramer Says That This Is a Question All Investors Must Ask Themselves

Elon Musk, Carlos Ghosn, Huawei and Gilead Sciences - 5 Things You Must Know

Elon Musk, Carlos Ghosn, Huawei and Gilead Sciences - 5 Things You Must Know

Stocks Extend Slide, U.S. Dollar Weakens as Trade Tensions Cloud Global Markets

Stocks Extend Slide, U.S. Dollar Weakens as Trade Tensions Cloud Global Markets