It needed a goal in the final minute of extra-time to see Cuikie over the third round hurdle at the Purdie Worldwide Community Stadium.
Aaron Somerville gave Penicuik the lead on the half-hour, lashing home after a Ryan Baptie free-kick was headed back across goal, but Callum Heath equalised for the hosts midway through the second period.
The sides couldn’t be separated after 90 minutes and it looked as if extra-time would fail to produce a winner as well, until the very last minute when Kieran Watson hammered the ball home after a scramble in the Blackburn box.
"Relieved, absolutely relieved,” was McLeish’s verdict when he spoke to Penicuik TV after the match.
"During the game we were a wee bit slow, took very little risk with the ball with sideways passing which isn't like us.
"Credit to Blackburn, they got their game plan right. They had two banks of four up against us and we couldn't play round them, we had to play through them
"But the boys kept going and in the last 15 minutes there was only going to be one winner.
"I think there's a bit of resilience there, a good level of fitness and absolute belief that in the full term of the game we can get a goal.”
The sides are due to meet again this Saturday in a league encounter at Penicuik Park.