( informal ) to suddenly produce sth as a solution to a problem
PULL STH / A RABBIT OUT OF THE HAT
Meaning of PULL STH / A RABBIT OUT OF THE HAT in English
Oxford Advanced Learner's English Dictionary. Оксфордский английский словарь для изучающик язык на продвинутом уровне. 2005