The 52-year-old was appearing in his first televised final and recovered from 9-7 down late in the piece to stop Van Gerwen from getting his hands on a fourth UK Open crown.
Van Gerwen checked out 170 to put him within a leg of victory and, after Gilding also survived a match dart in a nail-biting decider, he pinned double top to pick up the £110,000 prize, ending a six-match losing run against the Dutchman.
Gilding told the PDC TV: "I can't believe it. I didn't expect to win that game. I played steady all weekend, but I didn't feel like I played particularly brilliant darts.
"The crowd were absolutely amazing. I have been practising more, working hard and it's paying off. Now I've got to win all of these major titles."
Success for Gilding moved him into the world's top 25 and also guaranteed him a spot in November's Grand Slam of Darts.
World number three Van Gerwen had the beating of two of his Premier League rivals, Nathan Aspinall and Dimitri Van den Bergh, on finals day to secure his spot in another TV final.
The 33-year-old overcame Aspinall with an average of 99 in the last eight, before he booked a spot in the final with a ninth straight victory against Van den Bergh.
Van Gerwen said: "To play games like this are always difficult. Andrew had nothing to lose and I think he played really well.
"I think I made many mistakes and I know that, but I'm the only one to blame and fair play to Andrew.
"At this moment I can't find many positives. I'm here to win tournaments and when you don't do that it's disappointing.
"It is painful for me. It hurts. Everybody knows what I'm like, but I will take it on the chin. Credit to Andrew. He had a phenomenal tournament."