Queen of the South grabbed their first league win of the season but the Dumfries side's victory was marred by a late red card for captain David Lilley.
Queens had lost their opening two First Division games but they emerged deserved winners over the newly promoted Fifers despite a second-half fightback. The visitors had got off to a dream start with a goal in the third minute and looked to be coasting to the three points when they added a second early in the second period but Cowden pulled a goal back, with the outcome only being settled in the closing minutes.
Queens manager Kenny Brannigan said: "We needed that result after losing our first two league games and I thought we were worth our win.''
Queens went ahead when Paul Burns looking supiciously offside shot low past David Hay from 12 yards. The visitors kept up the attack and a rocket 25-yarder from Derek Holmes was inches off target. But the Fifers' John Dempster set up Mark Ramsay, whose shot was blocked by Lilley.
Queens soon had play back at the other end and Hay had to fingertip away a 20-yard shot from Willie McLaren.
McLaren then had a glorious chance when he caught out the home defence but with just Hay to beat he shot wide from 14 yards. Hay twice had to bring off good saves from Lilley before Queens grabbed their second in the 54th minute. McLaren was given too much space on the left and his cross picked out Holmes, who had an easy task to shoot home from five yards.
After Dempster had missed a good chance, Marc McKenzie gave Cowden a lifeline in the 65th minute, firing a spectacular 30-yard drive into the top corner. Colin Cameron then headed over and sub Brian Fairbairn blasted a 30-yard shot just wide for the home side .
But Queens weathered the storm and in 86 minutes McLaren's neat pass allowed Ryan McGuffie to net from close range. One minute later Lilley got his marching orders for his second booking, for a foul on Dempster.
Home manager Jimmy Nicholl said: "We started horrendously badly and losing that early goal put all our plans up in the air.
A deserved win for Queens but they went survived a sticky patch in the second half after McKenzie scored his spectacular counter from absolutely nothing.
Queens MAD man of the Match - Rocco Quinn - A solid performance in midfield.