Liam Polworth scored a stoppage-time winner as Caley Thistle moved into the top six with a dramatic 4-3 victory at New Douglas Park.
Greg Tansey and Polworth had John Hughes' side two goals up but Hamilton hit back through Carlton Morris and Ziggy Gordon. Tansey made it 3-2 with two minutes left but Christian Nade equalised, only for Polworth to conjure up a spectacular winning goal.
Later on Wednesday, Aberdeen missed the chance to go top of the Ladbrokes Premiership when they were held to a 0-0 draw by Partick Thistle at Pittodrie.
Third-placed Hearts beat bottom club Dundee United 3-2 at Tynecastle, with all the goals coming in the first half. Billy McKay converted a second-minute penalty for United but Gavin Reilly, Prince Buaben and Osman Sow (penalty) turned the game round. Scott Fraser pulled one back but the visitors had Mark Durnan sent off right on half-time.
Motherwell continued their good recent run by beating St Johnstone 2-0 at Fir Park thanks to goals from Ben Hall and Stephen Pearson.
The match between Dundee and Celtic was postponed due to a waterlogged pitch.