Motherwell’s 3-1 win over Kilmarnock on Friday night had confirmed St Mirren’s relegation to the Scottish Championship and Gary Teale’s side travelled to Dingwall with only pride to play for.
Saint’s striker Thompson and County’s Liam Boyce both had early chances before County opened the scoring from the penalty spot.
Boyce was floored in the box by Alan Gow and Martin Woods (16) stepped up to confidently dispatch the spot kick past Mark Ridgers and put his side 1-0 up.
The home side then went close to doubling their lead when Craig Curran raced in on goal only to be denied by a superb tackle from Jason Naismith.
The Buddies were back in the game just before the break when Stephen Mallan’s (39) long range shot took a deflection off Scott Boyd and gave Mark Brown no chance in the County goal.
Boyce had a golden chance to put the hosts back in front just before the half-time whistle blew but he failed to hit the target with a header from close range.
Woods almost grabbed his second of the game but his right-foot shot was smacked wide and Tony Dingwall went close for County with a right-foot shot.
County had a loud shout for a penalty when Jackson Irvine’s shot appeared to strike a hand in the box but referee Steven MacLean was unmoved and waved away the penalty appeals.
Saints were hanging on and had their keeper to thank as Ridgers kept out a certain goal from Dingwall with a superb stop.
Late drama then saw County keeper Brown concede a penalty in the 90th minute and get sent-off for a foul on Lewis Morgan in the box.
Veteran St Mirren striker Thompson kept his cool and stepped up to fire the ball in from the penalty spot to give the visitor’s a shock win that means County are only three points ahead of second-bottom Motherwell.