The victory maintained Shabab's close two-point lead at the top over nine-time winner Dhofar, which defeated relegation-threatened Jalan 4-2 at the Salalah Sports Complex.
After the 22nd round of action, Shabab, which has been on the top of the league since December, stayed ahead with 46 points while Dhofar is closely behind on 44.
The match between Shabab and Fanja got off to a frenetic pace with Shawqi slamming the opener in the very first minute of the match for the reigning champion.
But it took just a couple of minutes for Shabab to find the equaliser through Malki, who then put the leaders ahead just before the interval.
However, soon after resumption, Oman's star striker Abdulaziz al Miqbali got Fanja on equal terms and then put his team ahead in the 50th minute.
Fanja hung on to the 3-2 lead till the dying stages before Malki drew parity. It was left for Shabab's in-form Brazilian striker Loks to seal a thrilling win for Shabab with his 11th goal of the season.
With just four rounds remaining, the tussle for the trophy enters the final stretch and any slip for Salim Sultan-coached Shabab will be enough for Dhofar to seize the opportunity.
Dhofar has been in good form since Spain's Andrea Garcia took over in February and its attacking midfielder Raeed Ibrahim was the star in the win over Jalan with a double. Tamer al Haj and
Lawson Bikay were the other scorers for the Salalah giants, who are aiming for a record tenth title.
Both Fanja and Dhofar are tied with nine titles each and with just two points separating Dhofar from Shabab, the OPL title seems to be heading towards a thrilling finish.
Four-time winner Al Arouba's chances to narrow the lead with Dhofar suffered a jolt as it lost 1-3 to Suwaiq at the Sohar Sports Complex. Arouba is third with 38 points. Al Nasr's 2-0 win over debutant Rustaq, which is set to be relegated to the first division, saw it climb to fourth spot (34 points)
Other results: Muscat 1 Sohar 1, Oman 0 Al Nahda 0, Saham 1 Al Khabourah 1.
Standings [22 rounds]: 1 Al Shabab (46 points), 2 Dhofar (44), 3 Al Arouba (38), 4 Al Nasr (34), 5 Al Nahda (33), 6 Al Suwaiq (31), 7 Sohar (31), 8 Fanja (30), 9 Muscat (26), 10 Saham (26), 11 Al Khabourah (23), 12 Oman (21), 13 Al Rustaq (16), 14 Jalan (15).