Motherwell are up to third place in the Scottish Premiership after battling to a 1-0 win at bottom club St Johnstone on Saturday .
Saints had the first chance when Jason Holt's early corner from the left was headed wide from a good position by Liam Gordon.
Motherwell wasted a fantastic opportunity to break the deadlock on 14 minutes when Devante Cole somehow knocked the ball over from a yard out at the back post after an incisive run and cross by James Scott.
After 'Well defender Peter Hartley had been booked for a foul on the edge of his own box, Scott Tanser's low-free-kick was well saved by Mark Gillespie.
St Johnstone then had a decent penalty shout refused for Gallagher's challenge on Stevie May.
Gallagher headed a fine chance wide on 35 minutes after Liam Polworth's long free-kick into the Saints box.
Motherwell did hit the front on 41 minutes when a Polworth corner from the far side was headed down by Gallagher to Cole who this time didn't miss with a low shot.
The Steelmen survived a major scare on 54 minutes when Gillespie dived low to his right to superbly save a Tanser penalty awarded for Tait's innocuous looking challenge on Davidson.
Jermaine Hylton - a half-time Motherwell sub for Sherwin Seedorf - produced a fine burst down the left on 64 minutes and his cross was volleyed high and wide by Allan Campbell.
The away side had a fine chance to extend their lead on 77 minutes when an unmarked Peter Hartley headed straight at Zander Clark after Polworth's long delivery into the box.
St Johnstone should have levelled on 87 minutes when Davidson somehow headed wide from a Kennedy cross. Within a minute the hosts nearly scored again when May was thwarted by Gillespie at point blank range after another Kennedy centre.
There was drama in the final minute of injury time when Donnelly received a straight red card for a late challenge, but referee Gavin Duncan blew the final whistle a few seconds later to the delight of the travelling support.
Motherwell: Gillespie, Hartley, Gallagher, Tait, Grimshaw, Donnelly, Campbell, Polworth, Cole (Long 83), Scott (Ilic 66), Seedorf (Hylton 45).
Referee: Gavin Duncan