In one of the all-time classic matches in the history of the sport, Van Barneveld defied an average of 105.78 from Van Gerwen to book a last-eight clash with Michael Smith.
Van Gerwen edged the first set but Van Barneveld, a five-time world champion, took the second and third sets before Van Gerwen responded with a 170 checkout in set four.
At 2-2, Van Gerwen remained favourite, but his Dutch compatriot kept his composure at the business end of the fifth set to move closer to victory.
In the sixth, Van Barneveld moved to within one leg of a famous triumph, but Van Gerwen produced a strong leg to get back on level terms before checking out 135 to silence the pro-Barney crowd.
Van Gerwen had all of the momentum, but at 2-1 down in the seventh session, he missed a dart at double 20, which allowed Van Barneveld to return to the oche to take out 96 in two darts to clinch one of the biggest victories of his illustrious career.