Billy King hit the pick of the goals to delight a crowd of some 2,000 - the largest at Richmond Park in 18 months - as St Patrick's Athletic very much kept their title challenge on the boil.
Victory, their seventh on the bounce at home, edges Stephen O'Donnell’s side level on points with champions Shamrock Rovers at the top of the Premier Division table, if with two games more played.
Despite another spirited display, Longford's sorry campaign continues as the midlanders are now 25 games without a league win and 17 points adrift at the foot of the table.
With Vitezslav Jaros away on international duty with the Czech Republic under-21s, 36-year-old Barry Murphy came into Saints' goal for his first competitive game in over two years.
Brim full of confidence on the back of their superb form by the Camac, Saints were at it from the off and were close to an opening goal after just four minutes.
King worked a trick on the right to get to the end line to cross for the unmarked Chris Forrester who tamely side-footed off target without perhaps realising the time and space he had in the Longford area.
Though dominating the ball, St Pat’s had to survive a scare from Longford's first real foray forward on 15 minutes.
Aaron Robinson put Aaron McNally away on the right to cross into the area where Saints’ centre-back James Abankwah used his strength to muscle the ball away from Dean Williams.
Though the Longford striker went to ground, the visitors' loud appeals for a penalty weren’t entertained by referee Rob Hennessy.
It was soon back to defending their own area for Longford, Robinson doing well to get his body in the way of King’s drive as St Pat’s, passing it well, probed patiently for openings.
Almost inevitably the goal came, if out of little or nothing, on 28 minutes.
Forrester’s challenge won possession from Darragh Nugent with Alfie Lewis picking up the loose ball to lay it off to King some 30 yards out.
With little apparently on, the 27-year-old Scot took a step or two forward before striking a right-footed shot that was still rising as it arrowed past Lee Steacy to the back of the net.
It was King's fourth goal of the season and his first since the end of May and up there with the best goals seen at Richmond Park this season.
Despite their first half dominance, St Pat’s were stunned when sloppy defending presented Longford with an equaliser six minutes into the second half.
Though he had three attempts to gather, Murphy spilled an innocuous enough Dean Byrne free kick into his area with Williams then clumsily bundled over just outside the area by Paddy Barrett.
Williams exacted further punishment with a superbly struck free kick that rifled through the poorly assembled St Pat’s wall to beat Murphy’s dive to enter the corner of the net.
St Pat’s pressed to regain their lead, Matty Smith setting up King to shoot with the excellent Aaron O’Driscoll there to get his body in the way to block the fiercely struck shot.
The pressure on the visitors duly mounted and they succumbed on 67 minutes.
O’Driscoll stretched to cut out a dangerous cross from half-time substitute Jak Hickman. The ball bounced up perfectly for the arriving Forrester to blast a volley to the roof of the net.
Teenager Darragh Burns sealed St Pat’s win on 87 minutes, scooping home after King and Forester carved the opening.
To their credit, Longford kept playing and substitute Conor Davis got their second goal when tapping home McNally's cross six minutes into stoppage time.
St Patrick’s Athletic: Barry Murphy; Sam Bone, Paddy Barrett, James Abankwah (Jak Hickman h-t), Ian Bermingham; Darragh Burns (Nahum Melvin-Lambert 88), Alfie Lewis, Chris Forrester, Matty Smith; Billy King, Ronan Coughlan (Ben McCormack 73).
Longford Town: Lee Steacy; Shane Elworthy (Callum Warfield 73), Joe Manley, Aaron O’Driscoll, Dean Zambra; Aaron McNally, Aodh Dervin (Aaron Dobbs 82), Aaron Robinson, Dean Byrne (Conor Davis 68); Darragh Nugent; Dean Williams.
Referee: Rob Hennessy (Clare).