Lionel Ainsworth, brought back into the Motherwell side by Stuart McCall, opened the scoring after 13 minutes at McDiarmid Park before O’Halloran replied in the 40th and 80th minutes.
The win sees Saints leapfrog Partick Thistle to go up to eighth place in the Scottish Premiership table but leaves Motherwell just two points above bottom-placed Ross County.
In the early stages, Frazer Wright went closest for Saints, flicking on a delightful free-kick floated in by James McFadden but it went wide of the post.
O’Halloran, however, was caught in possession shortly afterwards, and Henrik Ojamaa’s pass eventually found its way to Ainsworth, who smashed the ball into the net.
The visitors dominated most of the first half although Saints skipper Dave Mackay went close with a thunderbolt of a free-kick from 25 yards out just after the half hour.
A few minutes later, some great work in the Saints box by Ojamaa created a shot for Ainsworth which was well saved by Alan Mannus. Saints broke fast in a classic counter-attack, Lee Croft pulled the ball back and O’Halloran kept his shot low for the equaliser.
Tommy Wright’s men seemed to come out for the second half with more desire for the contest and in the 71st minute, Croft crossed to find Frazer Wright unmarked in the box but he put his powerful header too close to Dan Twardzik in the Motherwell goal.
Ten minutes from the end, neat work down the left by McFadden saw him lay the ball off to O’Halloran on the edge of the box.
The Saints forward twisted past several defenders before calmly lifting it past the advancing Twardzik for his second goal. He had a late chance for a hat-trick but should probably have passed the ball rather than see his shot blocked.
For a frustrated McCall, Motherwell played some good football, especially early on, and the result could have been so different had Ainsworth’s second great chance not been well saved by Mannus.
A goal then would have put them two up. Instead, if Ross County defeat Aberdeen on Monday, Motherwell face being bottom of the table.