A lacklustre match devoid of clear-cut chances looked set to peter out into a tame goalless draw before the 18-year-old burst through to secure the three points on 79 minutes.
Glen, who marked his full debut in the SPL with a goal against St Mirren last weekend, enhanced his growing reputation to keep Hearts firmly on course for a seventh-place finish.
Inverness had their opportunities, especially before the interval, but the hosts, who also struck the bar through Christos Karipidis, edged a low-key contest.
Caretaker Hearts manager Stephen Frail made two enforced changes following the victory over St Mirren, with Christian Nade and Laryea Kingston dropping out through injury. Calum Elliot and Deividas Cesnauskis deputised.
Inverness made one alteration to the side which beat Kilmarnock 3-0 as Russell Duncan came in for Grant Munro.
Hearts, who named eight under-21 players in their 18-man squad, made the early running in front of a disappointing crowd.
After four minutes, Jose Goncalves' long throw down the left picked out Elliot in the penalty area and his header across goal was hastily cleared behind, prompting a succession of corners.
Saulius Mikoliunas, who had started brightly, then fed the on-rushing Glen but the youngster's first touch let him down and he could not trouble Michael Fraser.
Inverness replied with Dougie Imrie's cross from the left which was headed wide at the front post by Don Cowie.
Another corner from Ruben Palazuelos saw Karipidis nod into Fraser's arms, before Barry Wilson struck an ambitious dipping half-volley wide at the other end.
Duncan then found space 12 yards out after Imrie's quick throw-in but wildly sliced at the opportunity.
Hearts, though, came closest to a breakthrough on the 20-minute mark when Palazuelos' corner from the right again found Karipdis who struck the top of the bar with a firm header.
Glen blazed over from 12 yards with another chance after the ball had broken to him in the area.
Palazuelos should have netted seconds later, after Glen's cut-back left him with an easy chance to stroke home. Inexplicably, however, the Spaniard fluffed the opening as the ball hit his standing leg and bounced away.
Hearts were almost made to pay for the miss when, after 34 minutes, Steve Banks had to push away Cowie's 20-yard free-kick after Jason Thomson had fouled Dennis Wyness.
Banks was then forced to claw away a David Proctor header from Imrie's left-footed corner.
Seconds later, the same duo again combined from a corner, with Proctor nodding over.
Inverness sensed an opener from their sustained pressure and Banks was once more called into action to deny Wyness.
The first action of note in a poor opening to the start of the second half was the booking of Eggert Jonsson for a late challenge on Imrie.
Hearts made a tactical change after 53 minutes, withdrawing Cesnauskis and bringing on Lee Wallace.
The arrival of the left-back almost paid immediate dividends when Fraser brilliantly blocked at Wallace's feet after the ball had reached him at the far post.
Just before the hour mark, Wallace was again involved after Christophe Berra sprung the offside trap to find him space on the left side of the penalty box.
Instead of shooting, the young Scot looked to thread a pass across goal and the visitors hacked clear.
As Hearts sought the breakthrough goal, Fraser then moved to his right to clutch a long-range drive from Palazuelos.
Home fans were growing frustrated and they expressed their anger in the 76th minute when Elliot was taken off and Marius Zaliukas, a defensive-minded player, was drafted up front beside Glen.
However, they were on their feet just four minutes later when a fine passing move brought the decisive winner from Glen.
A neat one-two with Palazuelos saw the youngster burst into the penalty area and tuck the ball emphatically past Fraser.
Glen was substituted in the closing seconds to a fine ovation, allowing Scott Robinson to come on and become Hearts' youngster ever top-flight performer at the age of 16.