The first half was a tame affair with little for the 1,842 fans to get excited about.
Queen's looked the most threatening but could not find an opening.
And Cairney found the only goal of the game, picking up the ball on the edge of the box and rifling a low shot into the back of the net.
The first real piece of action was for the visitors and their front man Stephen Dobbie. He won the ball from Peter Murphy, but he dragged his shot wide of the target.
Minutes later Mark Millar tried his luck for Queens, but his shot was saved by the legs of Greg Fleming in the Ayr goal.
The next clear cut chance came just before the half time whistle. Jordan Marshall slipped away from his marker, he whipped in a great ball from the left, but Dobbie couldn't get his head to it.
The breakthrough came in the second half with Cairney's goal, and Ayr could have doubled their lead through Gary Harkins.
The striker had time, but failed to get the shot on target and launched the ball over the bar.
Ayr United move up to sixth spot in the Championship, with Queens now down to third after their second defeat in a row.
Match ends, Ayr United 1, Queen of the South 0.
Second Half ends, Ayr United 1, Queen of the South 0.
Corner,  Queen of the South. Conceded by Conrad Balatoni.
Attempt missed. Lee Robinson (Queen of the South) right footed shot from the centre of the box misses to the right.
Foul by Gary Harkins (Ayr United).
Jordan Marshall (Queen of the South) wins a free kick in the defensive half.
Brian Gilmour (Ayr United) wins a free kick in the defensive half.
Foul by Stephen Dobbie (Queen of the South).
Foul by Kevin Nisbet (Ayr United).
Andy Dowie (Queen of the South) wins a free kick in the attacking half.
Corner,  Queen of the South. Conceded by Nicky Devlin.
Attempt missed. Kevin Nisbet (Ayr United) right footed shot from the centre of the box is too high.
Jordan Marshall (Queen of the South) is shown the yellow card for a bad foul.
Brian Gilmour (Ayr United) wins a free kick in the defensive half.
Foul by Jordan Marshall (Queen of the South).
Attempt missed. Stephen Dobbie (Queen of the South) right footed shot from outside the box is close, but misses to the left.
Conrad Balatoni (Ayr United) wins a free kick in the attacking half.
Foul by Andy Dowie (Queen of the South).
Andy Dowie (Queen of the South) wins a free kick in the attacking half.
Foul by Kevin Nisbet (Ayr United).
Corner,  Ayr United. Conceded by Kyle Jacobs.
Substitution, Ayr United. Jamie Adams replaces Paul Cairney.
Attempt missed. Gary Harkins (Ayr United) right footed shot from the right side of the box is just a bit too high.
Foul by Gary Harkins (Ayr United).
Andy Dowie (Queen of the South) wins a free kick in the defensive half.
Substitution, Queen of the South. Steven Rigg replaces Dean Brotherston.
Paul Cairney (Ayr United) is shown the yellow card for a bad foul.
Foul by Paul Cairney (Ayr United).
Lyndon Dykes (Queen of the South) wins a free kick in the defensive half.
Foul by Brian Gilmour (Ayr United).
Grant Anderson (Queen of the South) wins a free kick in the defensive half.
Nicky Devlin (Ayr United) wins a free kick in the attacking half.
Foul by Grant Anderson (Queen of the South).
Attempt missed. Andy Dowie (Queen of the South) header from the centre of the box misses to the left.
Foul by Ross Docherty (Ayr United).
Kyle Jacobs (Queen of the South) wins a free kick in the defensive half.
Attempt missed. Lyndon Dykes (Queen of the South) header from the centre of the box misses to the right.
Substitution, Ayr United. Michael Donald replaces Alan Forrest.
Attempt missed. Kyle Jacobs (Queen of the South) right footed shot from outside the box is too high.
Substitution, Queen of the South. Grant Anderson replaces Jake Pickard.
A second half strike by Paul Cairney was enough to give Ayr United all three points against Queen of the South at Somerset Park.