In a lively start by the visitors O'Donovan headed in a George Francomb free-kick after six minutes, after earlier having the ball in the net only to see the flag up for offside.
In the 19th minute Griffiths made it number two from the spot after Ayr defender Andrew Geggan had fouled Hibs midfielder Isaiah Osbourne at a corner.
Ayr battled hard to get back into the game but the Clydesdale Bank Premier League side were always that bit superior and will look forward to tomorrow's draw.
Unusually, these days, both managers fielded unchanged sides for what turned out to be a good cup tie.
Pat Fenlon started with Griffiths and O'Donovan in attack while Ayr boss Brian Reid kept the same 11 for the fifth successive match with Keigan Parker and Mark Roberts leading the line.
A huge travelling support added to a cracking atmosphere inside one of the traditional football stadia in Scotland.
All those Hibs fans carried the hopes of recent generations, hoping to see the cup back in Leith for the first time since 1902, and they were treated to an encouraging start.
O'Donovan, on loan from Coventry, had the ball in the Ayr net in the fourth minute after Ivan Sproule's drive from 16 yards was spilled by Kevin Cuthbert, but the flag was up for offside.
But the travelling fans only had to wait two more minutes for the opener.
When Francomb whipped his free-kick in from wide on the left it found O'Donovan drifting into the box unmarked and his header beat Cuthbert and went in off the post.
The Leith side looked in the mood, swarming around the United box looking to get the second.
But in the 16th minute, after Easter Road defender Paul Hanlon fouled Parker wide on the right, the home side missed a great chance to draw level.
Michael McGowan's free-kick was met by Ayr defender Chris Smith only six yards out but he failed to make proper contact, allowing Hibs keeper Graham Stack to smother.
Two minutes later it looked like Geggan grabbed Osbourne at a Francomb corner and referee Steven McLean pointed to the spot and Griffiths scored number two from the spot.
Such was the force of the penalty that it took the netting away from its support.
On the half hour mark, after another swift Hibs break down the left, Sproule's cross was just behind the on-rushing O'Donovan, with Smith helping to clear.
Minutes later Smith made a great block tackle to foil Hibs left-back Pa Saikou Kujabi who had raced on to a Griffiths pass inside the Ayr box.
In the 39th minute, with the Ayr defence stretched in the face of another Easter Road counter-attack, Griffiths drew a good save from Cuthbert with a powerful drive which was heading for the top corner.
Cuthbert was called into action again just four minutes after the break when he had to block a shot from O'Donovan before Parker sent a weak free-kick from 25 yards into the arms of Stack.
While looking dangerous any time they went forward Hibs also looked fragile at the back, offering the part-timers a glimmer of hope.
Ayr almost got the lifeline they so desperately needed in the 56th minute but Stack made a great point-blank save from Geggan who had bulleted in a header from a McGowan cross, the Hibs keeper gathering at the second attempt.
Then, as the match swung from end to end, Hibs defender Hanlon headed a Francomb corner over the bar from six yards to remind the hosts of Hibs' threat.
Griffiths then missed a great chance to finish Ayr off when he raced through clear on goal, only to slash his shot wide of the target.
The home side kept at it, throwing bodies forward, but in the 76th minute Hanlon's header from a Francomb corner was cleared off the line by United right-back Jonathon Tiffoney, before Osbourne miscued in front of goal when he looked poised to score.
There was a vociferous appeal for an Ayr penalty in the 82nd minute when Hibs substitute Matt Doherty appeared to handle the ball as he fell in the box but the referee ignored the claims.
Having given themselves too much to do after going behind so early in the game, the home side ran out of steam, but Hibs can look forward to a semi-final at Hampden.