Thistle took the lead through Kris Doolan’s headed goal on 22 minutes before Callum Ball equalised on the hour mark.
But with time running out at Firhill, Abdul Osman was punished for handling a cross in the area and McLean sent his spot-kick straight down the middle of the goal.
Partick dominated the early exchanges, with Ryan Stevenson firing just wide of the mark before Doolan found the target.
Steven Lawless picked him out with a pinpoint cross and Doolan headed down and into the corner of the net after evading the attentions of Ellis Plummer.
Lawless and Doolan combined again soon afterwards but Doolan dragged his left-footed shot wide after latching onto a reverse pass from Lawless.
St Mirren began to find a way into the game though and Partick keeper Scott Fox was forced into saves either side of the break as John McGinn tried his luck from distance.
The equaliser still seemed unlikely until Jeroen Tesselaar powered forward and crossed for substitute Ball to steer a half-volley inside the post.
Tommy Craig’s side remained in the ascendancy, McGinn almost taking them into the lead with a cheeky chip, while Goodwin curled a 22-yard free-kick just wide.
Ball continued to add some vitality to the away side’s attacking play after combining well with Tesselaar but his low shot was blocked by Fox, who then pulled off an acrobatic one-handed save to keep out McLean’s 35-yard free-kick.
There was to be late drama though as Osman was adjudged to have deliberately handled Jason Naismith’s attempted cross and McLean kept his cool to score the winner from the spot.