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.
'Clearly I've been the best' - Trump slams ranking system as Selby set for number one spot
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.
Trump, O’Sullivan and Hendry commit to British Open
Trump disagrees with O'Sullivan over standard of players in snooker