The world number two fell 2-1 behind and then went 3-2 ahead, only for Hawkins to win three frames in a row.
Trump then staged a dramatic comeback and clinched successive frames to go through to the next round.
"Barry scored pretty heavily today and I don't know how I have turned it around," Trump told BBC Sport. "I kept breaking down and the nudges were not happening for me today but I am glad to get through.
"The UK Championship was bad for me. Maybe I went in too confidently but whoever you play here at the Masters, it will be a tough game.
"I still don't see myself as the favourite. Every tournament I play in, I see John Higgins as the favourite. Some people get carried away and knock down what I have done, I am still young and still have a lot to learn."