Last updated on .From the section Scottish Cup

Ten-man St Mirren scored twice in the final five minutes to avoid a Scottish Cup upset against Championship side Alloa Athletic.

Alloa led through Alan Trouten's 16th of the season before Brad Lyons was sent off on his St Mirren debut.

Kevin Cawley put the visitors 2-0 up before the break, but Cody Cooke gave St Mirren hope in the 68th minute.

Ethan Erhahon levelled a second with five minutes left, before Kyle McAllister struck a dramatic winner.

Victory, only St Mirren's fifth all season, brought some relief in a dispiriting campaign for Oran Kearney's side, who occupy the Scottish Premiership relegation play-off spot, two points from the bottom.

They next face a trip to champions Celtic on Wednesday, 23 January, while Alloa - eighth in the second tier - are free to concentrate on trying to remain in the Championship.

St Mirren boss Oran Kearney: "I said at half-time 2-0 is the hardest lead to defend in football. For all the preparation they did, I doubted whether they would know whether to stick or twist.

"At 2-2, I thought we would move on to the replay, but credit to Kyle. It was one of those moments where you knew a step or two before where it was going. He has a history with this club and he is so delighted to be home."

Alloa manager Jim Goodwin: "We were excellent in the first half and well in control. I question myself at half-time because we changed the tactics slightly and probably came off the game-plan too much.

"Did I give them the right message? I probably should have told them just to go out and get at them again. But we didn't do well enough in possession. We are better than that. I am absolutely gutted."