Gallagher, who had not scored in his last 16 outings, netted twice in between Michael Morrison's opening goal and a strike by Martyn Waghorn as the Foxes raced into a 4-0 half-time lead.
The visitors pulled a goal back through Paul Hayes soon after the break but the afternoon belonged to Gallagher and he completed his treble midway through the second half before leaving the field to a standing ovation seven minutes from time.
It could have been a different story had Chris Weale not saved from Hayes when the Scunthorpe striker was through on goal early on.
Leicester made them pay when Morrison headed Waghorn's free-kick into the top corner in the sixth minute.
Scunthorpe came close to an immediate equaliser but Grant McCann's shot drifted just wide.
Good link up play between Waghorn and Lloyd Dyer created the chance for Gallagher to double Leicester's lead in the 16th minute. After Dyer rolled the ball across the 18-yard line, Gallacher had time and space to pick his spot and his shot deflected into the top corner.
Once again Scunthorpe might have got themselves back into the game straight away but Weale tipped Rob Jones' header over the crossbar.
Gallagher grabbed his second goal following a 25th-minute foul by Michael O'Connor on Dyer. From the resulting free-kick, the former Blackburn forward curled a delightful right-foot shot round the wall and the ball nestled in the bottom corner.
Nine minutes later Gallagher turned provider as Waghorn got the goal his first-half performance deserved.
Gallagher's cross was only half-cleared and Waghorn controlled the ball on his chest before firing a half-volley past Joe Murphy, who got a hand on the shot but could only help it into the net.
Scunthorpe scored their consolation goal after 54 minutes. Michael Raynes reached the byline on the right-hand side and his cross was turned home from 12 yards out by Hayes via a deflection.
Gallagher completed the scoring, and his hat-trick, in the 73rd minute when he he headed home Richie Wellens' cross.
Ten minutes later, Gallagher was replaced by Dany N'Guessan and the majority of the Walkers Stadium rose to their feet in recognition of a sterling performance from the Scot.