Raith, looking to extend their 11-match unbeaten run, took the lead in the 34th minute when Dylan Easton finished off a quick passing move.
Jack Hamilton looked to have put the game beyond the relegation-battling visitors when he headed in a second on the hour.
The Red Lichties, though, mounted a superb fightback in the closing stages, sparked by a fine effort from Adams.
The 32-year-old keeper had been sent on for his league debut just before the hour mark, but as an outfield player to replace injured defender Aaron Steele after the visitors – with only four players named on the bench – had used up all their other substitutes.
With 15 minutes left, the ball dropped to Adams around 25 yards out – and he spun to crash a half-volley soaring over Rovers keeper Maciej Dabrowski and into the top corner.
Arbroath earned a point when Leighton McIntosh slotted in a penalty in the 81st minute following a handball by Scott Brown.
The hosts went in front through a Michael McKenna header in the 27th minute and quickly doubled the lead just eight minutes later when Jermaine Hylton slotted home.
They were handed a blow when Ricky Little was dismissed in the 38th minute after picking up his second yellow card of the game, but Airdrieonians were also reduced to 10 in the second-half after Liam McStravick picked up two yellow cards within the space of four minutes.
With a level playing field for the rest of the game, Arbroath secured victory in the final stages of the game with Jay Bird scoring in the 88th minute followed by Leighton McIntosh three minutes later.
Wallace Duffy sent the Caley Jags into the break ahead as, three minutes into stoppage time, he received Alex Samuel’s clever pass and beat Max Boruc from 10 yards out.
It was Arbroath who grabbed the next goal, however, when Leighton McIntosh found the back of the net from distance just after the hour.
The visitors would later go down to 10 men as Ricky Little earned a second yellow for fouling Billy Mckay and Inverness quickly took advantage through Samuel, who snaffled his fourth goal of the season.
Zak Delaney had the ball in the net for the hosts in the 11th minute at Gayfield, but his potential opener was chalked off for offside and it remained goalless at the break.
Robbie Crawford broke the deadlock with a lovely curled finish after 56 minutes, and the visitors doubled their advantage when George Oakley slotted home.
Michael McKenna tapped home Leighton McIntosh’s delivery to deny Morton the clean sheet, but they could not find an equaliser as they slumped to an eighth straight defeat.
The Honest Men had lost four of their last five matches in the league, including a 2-1 home defeat against Raith last time out, but they impressed at the Excelsior Stadium.
The visitors took the lead midway through the first half when a Jamie Murphy ball into the box was slotted home at the back post by Logan Chalmers.
Anton Dowds doubled Ayr’s advantage in the 53rd minute after evading a challenge and firing in a powerful effort with the help of a deflection.
Lewis McGregor pulled a goal back for Airdrieonians after 67 minutes following a scramble in the box but their two-game winning run was brought to an end.
The home side were cruising at the break.
Kurt Willoughby won and scored a penalty after 23 minutes to put them in front and Frankie Musonda doubled the Honest Men’s lead nine minutes later when he tucked home the rebound after goalkeeper Max Boruc had kept out the first effort.
A second penalty shortly before half-time made it comfortable for Ayr, with Anton Dowds scoring after Harry McHugh had been fouled.
Ben Dempsey added a fourth after 68 minutes, slotting home after a quick free-kick from Jamie Murphy, and Logan Chalmers capped an impressive display from the home side with a fifth in stoppage time.
Dowds nodded in just before the interval as he connected with a fine Francis Amartey cross.
That cancelled out Kirk Broadfoot’s 21st-minute opener for the visitors, the veteran defender meeting Michael Garrity’s free-kick to flick past Josh Clarke.
Dowds went close to hitting a winner, rattling the crossbar with a shot eight minutes after the break.
Ayr, in seventh, moved another point clear of ninth-placed Inverness with four matches to go, and are two points behind sixth-placed Morton.
Jakubiak struck twice within the opening nine minutes to put the Pars in command.
Ayr pulled one back four minutes before the break when Joe Chalmers failed to clear and Aiden McGeady swept home.
Skipper Frankie Musonda secured a point for Ayr by heading home George Stanger’s cross after 62 minutes.
Both sides battled heavy rain and wind and looked set to repeat the deadlock from their previous encounter at Gayfield just 10 days ago.
Jamie Murphy missed a chance to put the hosts in front from the penalty spot in the 55th minute when he hit the post and the rebound was pushed out for a corner.
Ben Dempsey finally made the breakthrough in the 74th minute with a brilliant long-range strike, and Logan Chalmers added the second from close range three minutes later to seal the win.
The visitors got off to a flying start when George Stanger headed in a Harry McHugh cross in the fifth minute.
Inverness, who remain second from bottom, responded well and, after James Carragher had sent a header inches wide from a free-kick, they levelled in first-half stoppage time when Billy McKay scored from the penalty spot.
Ayr regained the lead just after the hour mark through Fraser Bryden’s close-range finish from Anton Dowds’ pass.
Cammy Kerr fired wide for Caley Thistle, while at the other end Mark Ridgers pulled off a decent save to prevent Jamie Murphy from sealing the points for Ayr.
Across his three spells with the Championship club, Mckay has played 246 games and has scored 100 goals and is just one goal away from equalling Dennis Wyness’ club goalscoring record.
The 34-year-old had been linked with fellow Championship side Ayr United but has decided to stay in the Highlands.
Head coach Dodds told the club’s official website: “We’re delighted that Billy has extended his stay with the club.
“Billy is a key player for us, he was our top scorer last season and is an ultimate professional.”
“While he had offers from a number of clubs, some of whom were competitors in the Championship, the club had worked hard to make sure that Billy helps get us back into the Premiership and stays where he belongs, here at Caledonian Stadium.”
The Northern Ireland international joined Inverness initially from Northampton in 2011.
During his first spell at the club, he scored 62 goals in 141 games before joining Wigan in January, 2015.
McKay returned to Caley Thistle for a brief loan spell in January 2017 then returned to the club for third time in the summer of 2021 on a permanent basis.
Jack Turner converted Dom Thomas’ cross to put the Spiders ahead after 10 minutes.
But Inverness, who suffered defeat for the first time under Duncan Ferguson against Raith seven days earlier, levelled after 21 minutes through Max Anderson and Niko Ujdur’s close-range header put them ahead just before the hour mark.
David Wotherspoon provided a two-goal cushion 15 minutes from time, and Billy Mckay’s penalty completed the visitors’ biggest win of the season.
Caley captain McKay stepped up in the 18th minute after Paul Allan was judged to have fouled Cammy Kerr, but he was unable to get the better of Deniz Mehmet.
The visitors came close to nicking a lead of their own in the closing moments of the first half, Alex Jakubiak going past the keeper before seeing his shot cleared off the line by the retreating Danny Devine.
Devine had a chance at the other end but nodded wide and Dunfermline had a late opportunity to win it when Malachi Welch-Hayes’ header was palmed over by Mark Ridgers to leave both sides locked in the bottom three.
Airdrie keeper Robbie Hemfrey had to beat away Harry Milne’s early shot and then saw the defender head just over with 23 minutes gone at the Energy Check Stadium.
However, Lewis McGregor had a chance to put the visitors ahead 12 minutes before the break when he was played in one-one-one with David Mitchell, but the keeper blocked with his legs.
Thistle took the lead seven minutes after the restart when Kerr McInroy played in Aidan Fitzpatrick over the top and he evaded Hemfrey before firing home.
It was 2-0 within nine minutes when Graham pounced after Hemfrey had parried Ben Stanway’s effort, and he added his second seven minutes later before substitute Ricco Diack made it 4-0 as time ran down.
A first-half goal from Brian Graham and Scott Robinson’s second-half strike moved the third-placed hosts six points clear of their opponents, who dropped out of the top four.
Graham, the 36-year-old striker playing against the club with whom he began his career, had already warmed the palms of visiting goalkeeper Ryan Mullen when he struck after 28 minutes, receiving the ball before firing a low shot into the corner from long range.
Partick goalkeeper David Mitchell saved a Robbie Muirhead effort at the start of the second half.
But Robinson doubled the hosts lead in the 52nd minute, adding the finishing touch to Jack McMillan’s low cross.
Morton pulled a goal back deep into added time when Muirhead headed home from close range, but it was too little too late.
Gallagher’s 73nd-minute effort combined with results elsewhere saw Ian Murray’s men also surrender their lead at the top of the table.
Airdrie were on the front foot throughout with visiting goalkeeper Kevin Dabrowski doing well to save from Adam Frizzell before Gallagher headed over the bar.
Sam Stanton had Raith’s two best chances towards the end of the first half, denied by Airdrie goalkeeper Josh Rae before sending a long-range effort against the post.
Dabrowski saved well to deny Murray Aiken in the 70th minute but three minutes later the hosts made the decisive breakthrough when Lewis McGregor squared for Gallagher to slot home.
Matty Todd opened the scoring 11 minutes in, slotting home a cross from Kane Ritchie-Hosler’s cross, and the roles were reversed eight minutes before the break when Ritchie-Hosler was on hand to tuck home the rebound after Todd’s shot was deflected.
Louis Moult spurned a superb chance to get United back into the game six minutes into the second half, firing wide of Deniz Mehmet’s goal, and Ritchie-Hosler soon made him pay with his second of the night after linking up with Alex Jakubiak.
United did pull a goal back late on when Glenn Middleton’s deflected cross rolled over the line, but defeat means Raith Rovers could go top with a win when they visit Queen’s Park on Saturday.
When Dunfermline failed to clear Josh Mullin’s cross, O’Reilly fired the visitors in front with 11 minutes gone, but Ben Summers brought Dunfermline level with a superb solo goal, his first at senior level, seven minutes before half-time.
Six minutes into the second half, O’Reilly headed home from a corner and this time the hosts could not find a response.
The win keeps Rovers three points clear of Dundee United at the top of the table.
Nathan Shaw fired Caley Thistle ahead via a post in the 12th minute and Charlie Gilmour twice went close from distance while Adam Brooks had a goal disallowed for offside as the hosts controlled the first half.
The Pars were brighter after half-time and Michael O’Halloran fired a shot across the face of goal, while Inverness forward Brooks was booked for going on to finish after again being whistled offside.
Harry Sharp saved from Caley substitute Keith Bray and just two minutes later Dunfermline were level as Hamilton headed in Owen Moffat’s cross.
Moffat drew a good save from Mark Ridgers but neither side could find a winner, meaning Inverness still prop up the cinch Championship with a solitary point.
Brian Graham broke the deadlock in the 25th minute as the ball fell kindly to the 36-year-old striker, following Scott Robinson’s initial blocked effort, and managed to bundle over the line.
Dunfermline replied, however, with 12 minutes remaining when Chris Kane was brought down by Aaron Muirhead in the penalty area and the striker picked himself up to send David Mitchell the wrong way.
Thistle almost snatched victory three minutes later when Kerr McInroy hit the outside of the post from the edge of the box with home goalkeeper Deniz Mehmet beaten.