The 22-year-old striker smashed home the winner six minutes from the end of a dull affair which had looked set to end scoreless.
With neither side fashioning chances in the second half, Hendry's ninth goal of the campaign was at odds with most of the earlier action.
He timed his run into the six-yard box to perfection to smash home Drey Wright's fiercely driven cross from the right flank.
It was a bitter blow for Livingston, who had hoped to preserve a six-point advantage over Tommy Wright's side, who stretched their unbeaten run to seven games.
Lions defender Efe Ambrose lined up a tempting 25-yard free-kick in the eighth minute after a Gordon handball, but the Nigeria international's weak effort was aimed straight at the defensive wall.
But Perth goalkeeper Zander Clark produced an even more impressive stop seven minutes later to spare the blushes of errant defender Gordon. The centre-half's fluffed back header was pounced upon by Steven Lawless and his dipping 25-yarder was tipped over the bar by the backtracking Clark.
On the half-hour mark, Livi skipper Bartley sensed an opportunity at the back post but Gordon redeemed himself with a vital block at the expense of a corner.
Lawless had another chance in the 34th minute when he latched onto Bartley's prod into the penalty area. This time the attacker's angled shot eased wide of the far post.
Time-wasting earned needless cautions for rivals Craig Sibbald and Hendry, with Jack McMillan joining them for a hefty challenge.
Saints keeper Clark raced from his area nine minutes after the break in a sprint against Lyndon Dykes, but he had to improvise a header into touch after losing his footing.
Well-drilled Livi looked happy to settle for a point as the second half panned out but they were undone by Hendry's 84th-minute side-footed finish, which lifts Saints into seventh place, just one point behind Hibernian.