Ayr United 0 Greenock Morton 1
Substitute Jason Walker was the hero for 10-man Morton when he struck the only goal with two minutes remaining.
Walker turned smartly in the box to fire home from eight yards after a Ryan Harding free-kick was played on by star man Andy McLaren.
Whistle-happy referee Iain Fife ruined an entertaining match by booking eight players and sending off Morton skipper Stewart Greacen with 30 minutes to go.
Morton always looked the better side, and almost stamped their mark in the first minute when a McLaren free-kick picked out Derek Lilley, whose powerful header flew just wide.
The woodwork came to Ayr's rescue twice after two minutes as Morton finished the first half with a wave of attacks.
First Chris Templeman hit the post with a shot from six yards, and then Alex Walker rattled the upright with a 25 yarder.
When Greacen picked up a second yellow for a tame foul on Gareth Wardlaw after 62 minutes, Ayr tried hard to make their extra man count.
But Morton still looked the likelier side, and after a series of close calls got their reward with Walker's last-gasp winner.
Morton boss Jim McInally said: "We played a long time with 10 men but still dominated, and I think we got better as the game went on."
Ayr boss Robert Connor said: "Morton deserved to win. I felt we were second best and the result was a fair reflection of the game."