The opening minutes were evenly contested but it was the home side who opened the scoring when a stunning 25 yard volley by O’Kane who gave Penicuik keeper Conar Easton no chance.
Minutes later, with Penicuik slow to clear the ball they had Easton to thank when he got down quickly to save.
On the half hour, a pinpoint cross by Ryan Gay picked out Ryan McCallum, who headed the ball down to Aaron Somerville but his effort went wide of the goal.
Penicuik were not to be denied and in the 33rd minute Ryan McCallum’s first time strike off a Neil Jancyzk corner kick levelled the score at 1-1.
Musselburgh restored their lead five minutes later when a quick break from defence and some neat first time passing saw Matti King slip the ball past Easton. Two minutes into second half, Ryan Gay burst into the penalty box, appeared to have been tripped but instead was booked for diving.
Then, following a corner to Musselburgh, Easton needed two attempts to save a powerful strike from the edge of the penalty box.
Penicuik started to work their way into the game and Lewis Barr had a great chance but his header went straight into the arms of keeper Renton.
In the 78th minute, a fine move by Jancyzk saw his cross fall to Kyle Scott but his effort was brilliantly saved by Renton.
Three minutes later, a Penicuik corner kick was punched away by Renton but McCallum laid the ball back to Craig Hume who slammed home a deserved equaliser.
A Musselburgh break saw Thomson one on one with Easton but the winger’s strike hit Easton in the face and went out for a throw in.
Penicuik continued to press and got the winner in the 91st minute when Jancyzk’s cross to the back post was headed back across goal by Ryan Gay for Kyle Scott to slot the ball home.
Penicuik: Easton, MacDonald, McKenzie, Hume, Connolly, Janczyk, Gay, Barr, McCallum (c), Somerville, S Scott. Subs: Jones, K Scott.