The visitors, who were winless in five, started brightly and went in front after 14 minutes when Lionel Ainsworth capitalised on some sloppy defending to blast home from 10 yards out.
However, St Johnstone levelled before half-time through O'Halloran on the counter-attack after Alan Mannus had saved another Ainsworth shot.
Mannus again had to be alert to deny Henrik Ojamaa with his foot just after the hour mark.
At the other end, Dan Twardzik pulled off a fine save to keep out Frazer Wright's close-range header.
O'Halloran was then on hand to take advantage of an unfortunate defensive slip when slotting the ball into the bottom-right corner in the 80th minute after being fed by James McFadden.
The hosts could have had a third from another counter-attack, but had done enough to secure the victory and condemn Motherwell to a fifth consecutive loss.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.