The 25-year-old defender struck in the 54th minute when he finished from eight yards to condemn the Terriers to a third successive defeat, which leaves the visitors still uncertain of a play-off place.
Preston goalkeeper Thorsten Stuckmann was forced into two fine saves before the Lilywhites went ahead, but Chris Holroyd also struck a post for the hosts as they finally managed to claim three points.
Huddersfield striker Jordan Rhodes forced Stuckmann into action as the game came to life on the half hour.
Iain Hume then teed up Holroyd for a volley that bounced off the foot of the Huddersfield post before Rhodes watched a header fly inches over the Preston crossbar, with Stuckmann later denying him again.
The Lilywhites went ahead when Mayor surged into the Huddersfield penalty area and squared the ball for Chris Robertson to scoop the ball into the roof of the net, with Peter Clarke’s weak shot the best Huddersfield offered in response.