These two teams will meet again in the League on Saturday, and there was enough to suggest that that game will be keenly contested after an evening in which Celtic were perhaps flattered by the result.
The turning point was the sending-off of John O'Neil, the St Johnstone substitute, in the 98th minute, just four minutes after he had taken the field. The winger appeared to aim a kick at Stephane Mahe, the Celtic defender, and was immediately ordered from the field.
Before the end of the first period of extra time, Celtic were awarded a penalty when Calum Davidson was adjudged to have handled a Mahe cross. Donnelly swept the ball into the net with a confidence that belied his team's performance.
There were a few signs that the coach, Wim Jansen, is beginning to get things together at the club, but there is still not enough quality about this Celtic side to lift it out of the ordinary.
In the second half Celtic created the better chances, with Henrik Larsson twice coming close and Darren Jackson having a header saved by Alan Main. The home side had hit the post in the first half, and as the game went into extra time there was an added edge to the match.
O'Neil was the first of two Saints' players to be ordered off, the second being his fellow substitute, Roddy Grant, who pushed the ball into the net with his hands just 60 seconds after a first caution.
"Of the two games this week I have always said I'd rather we won the League game, so I'm looking for my players to go one better on Saturday," Paul Sturrock, the St Johnstone manager, said.
St Johnstone (4-1-4-1): Main; McQuillan, Weir, McCluskey, Davidson; Kane; Sekerlioglu, O'Halloran (O'Neil, 94), Scott (Farquhar, 105), Preston (R Grant, 105); O'Boyle.
Celtic (4-4-2): Gould; Hannah, Boyd, Mackay, Mahe; Donnelly, Burley, Wieghorst (P Grant, 119), O'Donnell; Larsson, Jackson (Thom, 112). Subtitute not used: Gray.
Referee: H Dallas (Motherwell).Reuse content