Mark Davis won 6-5, having looked to have blown his chance when he led 5-2 but allowed Higgins back to 5-5.
A lifeline came his way though when Higgins, seemingly on a victory charge, missed the pink. Davis got it, and that was enough. He will take on Matthew Stevens in the quarter-finals on Thursday.
"I'm gutted. Normally clearing up in the last frame I'd have done it," Higgins said. "I didn't deserve to win that match. Who knows where the 147 came from?"
The four-time world champion initially looked a beaten man when Davis pulled to within a frame of victory with back-to-back breaks of 106 and 103.
A comeback by the Wishaw man was fired by the 147 in the eighth frame, bringing the crowd at York's Barbican Centre to their feet and rousing the 37-year-old Scot who earns £10,000 for his effort.
Higgins got back to 5-5 but again looked to be heading out as 40-year-old Hastings potter Davis built a 53-0 lead in the deciding frame.
There was a twist, as Davis missed a difficult red to centre that gave Higgins a half chance. In went a brilliant long red to the yellow pocket, and he reached 49, the pink seemingly a formality with the black surely to follow.
Somehow Higgins missed, and after a safety tussle he left Davis a difficult cut to the yellow pocket, which he made quite brilliantly. It was the ball he required, and Higgins rose from his chair to offer a congratulatory handshake.
Delighted winner Davis said: "I didn't expect John to miss the pink but he wasn't just rolling it in. It was a tough shot under pressure.
"It gave me another chance which in the end I managed to take. I was going for doubles and all sorts in the end. It was like the 1985 World Championship final."
Asked where it ranked in his victories, Davis said: "This is at the top. I've not got a good record against John at all. It's my best result for a very long time."
The scintillating late-night entertainment followed an earlier victory by the Belgian teenager Luca Brecel, who claimed he could win the title after setting up a quarter-final against Shaun Murphy.
Brecel came from 3-0 behind to beat Romford's Mark King 6-4.
Were he to triumph on Sunday, Brecel would break Ronnie O'Sullivan's record as the youngest winner of a ranking tournament. O'Sullivan won this event in 1993, seven days shy of his 18th birthday.
Brecel, who has three months left as a 17-year-old, has been long backed to win many professional titles, and he lacks none of the confidence that champions require. What he does lack is experience, with this just his second major tournament, having also qualified for the World Championship in April.
Asked if he could carry off the title this weekend, Brecel said: "I can win, but we'll see what happens."
Murphy has had his eye on the youngster for several years, and ahead of their tussle on Thursday said: "He's looking like the real deal."
Mark Selby came through his second-round test in similar circumstances, sliding 3-0 adrift against Wales' Ryan Day but recovering to win 6-4, and the Leicester man will replace Judd Trump as world number one should he reach the final.
Australian Neil Robertson was largely untroubled by Barry Hawkins, beating the Kent cueman 6-2, aided by breaks of 57, 67 and a closing 68. The 2010 world champion will tackle Selby on Friday, with a semi-final place at stake.
Robertson, frustrated to learn his beloved Chelsea had been eliminated from the Champions League, was unhappy with playing conditions and said: "The table was atrocious. I'll be filling out a form for the tournament directors' office because it was the worst I've played on as a professional.