A rare goal from defender Ziggy Gordon early in the second half proved enough for Alex Neil's side to claim the three points.
Accies created enough chances in the first half to have won the match comfortably but a combination of good goalkeeping from Grant Adam and some careless finishing kept Cowdenbeath in the game.
The breakthrough came after 51 minutes when Gordon accepted Ali Crawford's pass and beat two defenders before shooting past Adam at his near post.
Cowdenbeath could have salvaged something in the closing minutes but Jon Robertson and Kane Hemmings both squandered clear-cut openings and a draw would have been harsh on Hamilton.
Raith Rovers recorded their first home league win since March as they scored two late goals to see off Alloa Athletic 4-2.
Kevin Cawley put Alloa ahead in the first half after a great pass from Stephen Simmons but Joe Cardle equalised when his cross caught out Alloa goalkeeper Scott Bain.
An early second-half strike by Grant Anderson put the Kirkcaldy team in front but Ryan McCord restored parity with a 62nd-minute penalty after Anderson fouled Daryll Meggatt.
Calum Elliot's diving header in the 79th minute put Rovers ahead before Cardle made it 4-2 in stoppage-time.
Falkirk brushed Dundee aside 3-1 to jump to third place behind Raith, with Rory Loy scoring a double.
Loy put Falkirk ahead in the first half and a mistake by Dundee goalkeeper Kyle Letheren presented Jay Fulton with their second goal.
Loy made it 3-0 after 63 minutes before Dundee secured a late consolation when Ryan Conroy's shot went in off David McCracken.
Queen of the South sent Morton to joint bottom of the table alongside Livingston with a 2-0 win at Cappielow.
Allan Moore's men did everything but score - even missing a penalty in the second half - as they let Queens off the hook.
The home side's Tony Wallace beat Callum Antell in the first half but Andy Dowie managed to block his shot.
Antell was the busier goalkeeper but Queens went in front just before half-time when Iain Russell headed home Michael Paton's cross.
Michal Habai missed a good chance for Morton at the start of the second half before Derek Lyle got a second goal for Queens 2-0 after 58 minutes.
Reece Hands had a great chance to pull a goal back when Morton were awarded a 62nd-minute penalty but he sent his spot-kick skywards.
Kevin Dzierzawski was then denied by Antell as Morton were left frustrated.
A double from Marc McNulty gave Livingston their first league win as they held off Dumbarton 2-1 at the Bet Butler Stadium.
Dumbarton took the lead just before the break when Colin Nish set up Mitch Megginson to score with a stunning strike.
Livingston equalised at the start of the second half when McNulty converted a cross from Mike Mampuya.
McNulty added his second in 76 minutes, finding the top corner for the winner.