Three-time world champion Williams played just one shot in the final, his break-off shot leaving Vafaei the chance to pot a difficult long red into the corner pocket.
Vafaei went on to make a break of 71 to secure the title and dedicated the victory to his grandmother, who died recently.
“That is for you grandma,” the 27-year-old told Eurosport, adding, “It’s Mother’s Day in Iran and I am very proud I did that. I could not be more happy.
“It’s a big achievement for a country like Iran. Nobody knew about snooker before. Now they know. I’ve been working hard and thank God that finally I win a tournament and make my people proud,” he stated.
Williams was gracious in defeat, saying, “I thought I’d played a pretty good break-off shot there and what a fantastic red that was. To make that break under pressure to win your first tournament, hats off to him.”
Vafaei had looked set to lose his semi-final to Liang Wenbo, only for the Chinese player to miscue and pot the white while attempting a straightforward black off its spot on a break of 48.
Vafaei took advantage with a break of 54 to set up a final against Williams, who had made a clearance of 80 in his semi-final against England’s Robbie Williams.