The opening goal came six minutes from half-time when Grant Gillespie sent Darian MacKinnon through on goal and his parting shot was deflected past Calum Antel in the Doonhamers goal by his defender Mark Durnan.
The New Douglas Park men did not have it all their own way and Durnan headed against a post in the second half and Gavin Reilly screwed a shot wide just before the points were secured on 79 minutes.
Former Livingston man Tony Andreu darted to the bye-line and cut the ball back perfectly for fellow substitute Andy Ryan to shoot home from close range.
Accies player/manager Alex Neil said: “This was a really tough test for us as Queen of the South came here undefeated and full of confidence after a great season when they ran away with the Second Division.
“I am therefore delighted with how the game went and the performance put in by the players.”
Dumfries boss Jim McIntyre took his share of responsibility for the first defeat in his time in charge at Palmerston and said: “I went with the boys that had given us the unbeaten start, but I should have freshened things up after playing Airdrie in midweek. If Mark’s header had gone in, it may have turned out differently, but it didn’t and we move on to St Mirren on Tuesday night.”
Falkirk sit second, two points behind Hamilton, after a Philip Roberts hat-trick helped them see off Livingston 3-0 at the Energy Assets Arena. The former Arsenal and Inverness Caledonian Thistle front man is following in the goal-grabbing footsteps of Farid El-Alagui and Lyle Taylor for the Bairns and he showed his prowess in front of goal when he swept home a cutback by Rory Loy with half an hour gone.
His second came four minutes from the break when he held off Callum Fordyce before shooting home and the match ball was coming home with the 19-year-old when he headed home a Kieran Duffie cross nine minutes after the break.
Colin Nish was another striker in form as he scored on his debut for Dumbarton in a 3-1 home success against Morton. Nish set up the opener for Mitchel Megginson with a chipped back post cross that the former Aberdeen front man headed in at the second attempt on 18 minutes.
However, within 60 seconds Dougie Imrie had levelled for the Greenock men from the penalty spot after he had been chopped down by Scott Smith.
Nish took advantage of a poor pass back by Scott Taggart to slide his new side ahead just before the interval and the points were secured eight minutes from time when substitute Steven McDougall headed in a Smith cross.
Alloa enjoyed a second home win of the season when they beat Cowdenbeath 3-1 with Ben Gordon opening the scoring with a header five minutes after the break. Kane Hemmings quickly replied for the Fifers when he nodded in a Jordan Morton free-kick. However, Andy Kirk slotted home via a post and Eddie Ferns burst through the visiting defence to net and win all three points for the Wasps.
Raith Rovers and Dundee cancelled each other out at Stark’s Park in a goalless draw with the Dark Blues having the bigger grievances over the result.
The Dens Park men believed they should have had a penalty ten minutes from half-time when Calum Elliot tangled with Peter MacDonald, but referee John Beaton waved aside their appeals. Beaton also cancelled out a Declan Gallacher header from a Jim McAllister corner and Raith goalkeeper David McGurn also did his bit to keep the scoreline blank with a tremendous one-handed save to deny Gallacher midway through the second half.