Definition
To unexpectedly do something that improves a bad situation; to devise a clever solution when needed.
In the final minutes of the game, the team pulled something out of the bag, surprisingly winning the match.
When we thought the project would fail, she pulled a solution out of the hat, getting everything back on track.
Faced with budget cuts, they had to pull something out of the bag to make ends meet.