Victory wins!

Victory Memorial Hospital closed for good on June 30 — but an unexpected 11th-hour deal will keep the Dyker Heights medical center in good health.

On July 1 — when Victory was scheduled to lose its license from the state — SUNY Downstate Medical Center took over, renaming the bankrupt 92nd Street hospital “SUNY Downstate at Bay Ridge,” Downstate spokesman Ron Najman said.

The back-room deal, which had been in negotiations for several weeks, continued normal operations at Victory, abating the fears of many employees and nearby residents who worried that the hospital’s pending closure would leave the neighborhood underserved.

The “new” facility will continue Victory’s urgent care center and Victory’s diagnostic and treatment center, which provides ongoing, non-emergency care, Najman said.

Victory will continue to run its ambulatory surgery unit — which conducts surgeries that do not require overnight stays — until Downstate receives a state certification to run that unit as well, hospital employees said. That certification could come as early as this week.

SUNY Downstate Bay Ridge will rent the space from the Abe Leser Group, a Borough Park real-estate firm, which bought the beleaguered hospital for $44.9 million in May.

Downstate will retain some Victory employees, Najman said.

The news that Downstate would take over was just one more surprise for Victory employees, who have been anything but sure about the future of the hospital since a 2006 state commission deemed that it be shut down.

And a pending hospital-wide meeting put many Victory employees on edge about the security of their jobs.

“As long as I have a job, I don’t care, but I just wish they’d let the people who work here know what’s going on,” said technician Jeremy Marshall.

At Victory, it’s always safest to predict the unpredictable — and in a development only fitting for the capricious hospital, TV producer J.J. Abrams — the man behind the mystery show “Lost” — was set to film an episode of his new show, “Fringe,” at the medical center on Friday.

— with Jessica Firger, Emily Lavin and Michael Lipkin