Make something great out of a bad situation

[She] knew how to make a gourmet meal out of leftovers.

An example, admittedly of the literal usage, can be found in 'Beyond Passing' By Elaine Galindo

The parallel form would be

She made a gourmet meal out of [mere] leftovers.


Perhaps "snatched victory from the jaws of defeat" suggests what you'd like -- a last-minute success in an unlikely situation.