Greg Stewart scored twice as Cowdenbeath took control of their Scottish Championship play-off semi-final with a first-leg win at Ayr.
Stewart struck the opener after 16 minutes when he tucked the ball home at the far post.
He doubled the lead eight minutes from half-time, finding the top corner with a fierce drive from Lewis Milne's pass.
United's Gordon Pope had already found the side-netting before prodded home a corner with 11 minutes remaining.
Blue Brazil manager Jimmy Nicholl had urged his players not to feel sorry for themselves after Queen of the South's stoppage-time equaliser on Saturday ensured their place in the play-offs after finishing second bottom in the Championship.
They responded by taking control early in the game on their way to a third win in their last four outings.
Ayr had ended a run of five games without a victory on Saturday by defeating East Fife 4-1 to ensure fourth spot in the League One table.
However, forward Stewart, who had recovered from a knock to take his place in Cowden's starting line-up, put his side in the driving seat after taking his season's tally to 14 goals.
Ayr: Hutton, Hunter, McAusland, Lithgow, Pope, Forrest (Shankland 71), Gilmour, McLaughlin, Marenghi (Kyle 60), Moffat, Malcolm. Subs Not Used: Newman, McGowan, Longridge, Robert Crawford, Wardrobe.
Goals: Pope 79.
Cowdenbeath: Flynn, McKeown, Armstrong (Kane 46), Wedderburn, O'Brien, Brett, Milne, Robertson, Brownlie, Greg Stewart, Hemmings. Subs Not Used: Adamson, Stevenson, Morton, Gold, Usai, Miller.
Booked: Greg Stewart.
Goals: Greg Stewart 15,37.
Ref: Don Robertson