Trump won the opening three frames with breaks of 135 and 74 as he aimed to swiftly reach the quarter-finals.
But Perry bounced back in style, reeling off four frames on the spin – including a 123 and 129 – to move within one frame of victory.
The Masters
Jimmy White vs Judd Trump's Eurosport Masters shot of the championship pot
16/01/2022 AT 21:30
Trump fought back to take the match to a decider, and he went on to clinch a tense final frame which lasted 38 minutes.
Trump goes on to face MichaelHolt for a place in the semi-finals, who overcame home favourite Ding Junhui with a comprehensive 5-1 win.
Ding, who won this tournament in 2017, could not prevent Holt from taking a 3-0 lead before getting his first and only frame on the board.
Holt then sealed his last-eight spot with the next two frames.
KyrenWilson blew Jack Lisowski away to reach the last eight with a 5-1 victory.
After opening with a 77 and 86, Wilson recorded centuries of 108 and 102 en route to an impressive win.
Wilson faces ZhouYuelong next after the Chinese player powered past Ali Carter 5-2.
Zhou started with a superb 131 and then moved 2-1 up with a 134, and he managed to close the match out despite an impressive 141 from Carter.
The Masters
'No regrets' - Trump not disappointed with Masters loss to Hawkins
16/01/2022 AT 13:25
The Masters
Hawkins topples Trump in deciding frame to set up Masters final clash with Robertson
15/01/2022 AT 23:30