Dundeeās wait for an away league victory is over.
Beating one of the early Championship pacesetters on their own ground was just the start the Dark Blues needed to a four-game fortnight that culminates in the second city derby of the season. It was just the statement they needed too.
James McPakeās men have struggled on the road and they had to show plenty of heart to end their winless run at Somerset Park.
With the six-minute weekend capitulation to Partick Thistle still fresh in their minds they were faced with the possibility of another damaging comeback when Luke McCowan pulled a goal back after Declan McDaid and Paul McGowan had given the Dens Park side a two-goal cushion.
They stood strong this time, though, and the gap to the top of the table is now just three points.
As expected Conor Hazard made his debut for Dundee in goal, with Cammy Kerr and Andrew Nelson also given starts.
It was another on-loan Celtic keeper, Ayrās Ross Doohan, who caught the eye in the first minute, though. With Kane Hemmings putting him under pressure, Doohan showed footwork an outfield player would have been proud of to play his way out of trouble.
The first chance of the night came on five minutes. Michael Moffat played a one-two with Jordan Houston but, with plenty of time to pick his spot, the experienced forward shot straight at Hazard.
Moments later Graham Dorrans would have been disappointed not to at least work Doohan with a 22-yard free-kick that missed the target by some distance.
Nelson did force the goalie into making a save on 11 minutes but it was a straightforward one as the distance and acute angle were against the attacker.
At the other end Alan Forrest was much closer to goal when he shot low and hard a couple of minutes after and Hazardās block with his feet was an excellent one.
An even match swung Dundeeās way with the opener on 17 minutes.
McDaid stepped in off his right wing to feed the ball into the feet of Nelson, who gave an accurate wall-pass back. There was still a lot to do but Doohan was helpless as the ex-Ayr wingerās low, 20-yarder flew past him into his bottom left corner.
Dundee had their new keeper to thank for the lead not being wiped out within 10 minutes.
A defence-splitting pass from Ross Docherty put Moffat through one-on-one with Hazard. The Northern Irishman didnāt commit himself too early and when Moffat shot he made a fine save. The danger wasnāt over yet, though. Forrest should have put away the loose ball but he scuffed his effort past the post.
From nearly being pegged back to 1-1, the Dark Blues very quickly earned themselves some breathing space.
Just after the half-hour mark a clash between McGowan and Andy Geggan in midfield resulted in Dundee being awarded a free-kick (and both men being booked). Dorrans floated the dead ball to the back post where Jordon Forster saw his shot saved. The rebound dropped perfectly for McGowan who was lethal from 12 yards.
That breathing space didnāt last long, mind you. Six minutes to be exact.
It was Ayrās turn to cash in on a set-piece.
Stephen Kellyās diagonal free-kick was directed back across goal by Aaron Muirhead and Hazard had precious little chance of keeping McCowanās close-range header out of the net.
Just four minutes into the second half Ayr made their first substitution ā Craig Moore for Geggan.
Switching on at set-pieces would have been one of McPakeās half-time messages no doubt (not for the first time this season) and he would have been pleased to see his team repel three early corners.
Less pleasing to the Dundee boss would have been the way they gifted possession in their own half and ended up relying on McCowan making a mess of a shot inside the box as Ayr quickly broke on them.
Something similar happened again on 61 minutes when Shaun Byrne was looking for a foul after being robbed of the ball. While he was lying on the ground United were on the attack and Forestās edge of the box curler narrowly missed the target.
An Ayr equaliser was looking likelier than a Dundee third but the shots that Hazard was saving were all fairly comfortable ones, an angled effort from Forrest midway through the half one example.
McPakeās substitutions were a talking point on Saturday and his first in this game, Sean Mackie for Nelson, was made on 77 minutes. Danny Johnson came on for Hemmings a few minutes later and then it was Josh Todd for McGowan as the clock ran down.
Dundee saw the game out in some comfort and the win was secured.
Attendance 1,627.