Mahmood had previously taken only four first-class wickets this summer
Kent took less than two hours to claim the last five wickets on the final day as Division Two leaders Gloucestershire suffered a first defeat of the season.
All-rounder Azhar Mahmood set up the 76-run win at Beckenham, taking 5-39 as Gloucester were bowled out for 255.
He was well backed by James Tredwell, who finished with 4-89 to help Kent move to within nine points of the top.
But Mahmood finished the match off with the second new ball, having last man Steven Kirby caught at second slip.
It was only Mahmood's second Championship appearance of the season, having not played since Kent's first game in April - and Kent admit that they have to be protective of the 34-year-old former Pakistan Test all-rounder.
Skipper Rob Key told BBC Radio Kent:
"He's not played much championship cricket as he's not the youngest guy.
"He won't last the summer if he plays all of the championship and all the one-dayers.
"We pick and choose and every time he comes in and he does a great job.
"It got closer than we would have liked but we were favourites to win and it was a case of getting the job done."
Bookmark with:
What are these?