Following a goalless first half at the Perak Stadium, it looked as though the Singaporean side were headed for only their third defeat of the season after Paulo Rangel fired the hosts ahead a minute before the hour mark.
But after being thrown on in the 71st minute, it took Shahfiq just five minutes to make an impact as he equalised with a 30-yard piledriver to earn his side a share of the spoils.
And based on how the game unfolded, it is likely that LIONSXII coach V. Sundramoorthy will be happy to leave Ipoh with a point after his charges were outplayed for large portions of the match.
Despite entering Tuesday's game 14 points behind their opponents in eighth place, Perak showed excellent initiative from the opening whistle and were unlucky not to open the scoring in the 22nd minute; Azlan Ismail unleashing a blistering shot from 20 yards out that sailed past Izwan Mahbud's despairing dive before coming back off the bar.
Three minutes after the half-hour mark, the hosts had another good effort when Rangel hit an excellent half-volley on the turn from just outside the box, only to see Izwan tip it over with a fine save.
Perak did have the ball in the back of the net two minutes into the second half when Azlan poked the ball home from close range but the strike was correctly ruled out for offside, before Shahril Ishak had the LIONSXII's first real chance of the game in the 52nd minute; latching onto Hariss Harun's over-the-top pass before seeing his shot from a tight angle parried by Farizal Marlias.
But seven minutes later, Seladang were finally rewarded for their endeavour as they took the lead after Izwan pulled off a good save to keep out Yong Kuong Yong's drilled effort but only succeeded in pushing the ball to Rangel, who made no mistake in firing home the rebound.
As the game entered its final 20 minutes, Sundramoorthy decided to change things up in attack by brining Shahfiq on for Safirul Sulaiman, a move which paid off 14 minutes from time when the youngster lined up a freekick from 30 yards out and unleashed a vicious strike that dipped past Farizal and in off the bar.
Ten minutes later, another excellent set-piece delivery from Shahfiq looked to have handed the visitors all three points as another of his freekicks was headed home by Shakir Hamzah, only for the strike to be chalked off for an earlier foul by the LIONSXII defender.
Just as the Singaporeans looked to have done enough for the draw, Perak managed to carve out two more excellent chances in injury-time.
First, Izwan's failure to cleanly gather a tame shot by Nasir Basharuddin presented Rangel with a good chance from four yards out, but the keeper did well to recover and keep out the Brazilian's follow-up effort.
Shortly after, Abdul Hadi Yahya met a right-wing cross from S. Chanturu with a header that seemed destined for the back of the net, but Izwan was on hand to claw it away. The Perak players appeared convinced the ball had crossed the line, but the referee was having none of it and waved play on.
By now, emotions were running high and Perak soon found themselves reduced to ten men when Khairi Kiman picked up two bookings in a couple of minutes. Tempers eventually boiled over at the final whistle as players from both sides confronted each other heatedly at the final whistle, over an incident that happened on the field moments earlier.
Still, the LIONSXII did enough to edge one step closer to the Super League crown as they remained four points clear of the chasing pack, and can now wrap up the title against FELDA United in a week's time.
Perak: Farizal Marlias, V. Thirumurugan (Noor Hazrul Mustafa 82'), Hisyamudin Sha'ari, Rafael Souza, Khairi Kiman, M. Sivakumar, Shahrulnizam Mustapa (S. Chanturu 75'), Nasir Basharuddin, Yong Kuong Yong, Azlan Ismail (Abdul Hadi Yahya 76'), Paulo Rangel.
LIONSXII: Izwan Mahbud, Faritz Hameed, Safuwan Baharudin, Shakir Hamzah, Irwan Shah, Isa Halim, Aqhari Abdullah, Hariss Harun, Shahril Ishak, Safirul Sulaiman (Shahfiq Ghani 71'), Fazrul Nawaz (Zulfahmi Arifin 80').
Image courtesy of FAS (Alfie Lee)