Dundee United midfielder Charlie Miller secured his new club's first league win for almost a year with a dramatic late winner from the penalty spot against Dunfermline.
The Tannadice side had been put on course for the victory through first half goals by Sean O'Connor and Craig Easton.
But the Pars struck back in the second period as Lee Bullen and David Moss notched for the visitors.
However former Rangers man Miller struck home from the spot in an ill-tempered match which saw three players dismissed.
Dunfermline defender Youssef Rossi was first to go on the stroke of half-time before he was joined by United goalscorer Easton and team-mate Moss.
The misery was compounded for Moroccan Youssef, who now finds himself at the centre of a police enquiry after making a gesture to the home fans following his sending off.
United made the perfect start when striker O'Connor pounced to drive the ball past Pars goalkeeper Marco Ruitenbeek, taking advantage of a slip by Justin Skinner in the penalty area.
United continued to force Dunfermline back and confidence was high, highlighted by several good efforts by Miller.
Unfortunately for goal scorer O'Connor his afternoon was to be brief, when he had to be replaced by Neil Heaney after a clash with Moss.
With Dunfermline toiling, United grabbed a morale boosting second on the stroke of half-time.
Heaney sped down the right flank, and from his excellent low cross, Easton delivered a superb header after a well-timed run.
Confidence in the Tannadice ranks was heightened further when Rossi was sent off just before the interval after an untidy clash with Beto Naveda on the touchline.
Dunfermline boss Jimmyad obviously sent his charges out in more resilient mood after the break, as the visitors began to dominate without any real reward.
But the first sign of things to come for United came when Easton was red-carded in the 58th minute after a poorly judged tackle on Dunfermline substitute Steven Boyle.
Pars capitalised on United's disorganisation by pulling a goal back on the hour mark.
Bullen made a timely intervention to shoot home after Barry Nicholson had picked out Moss who headed back across goal.
Only four minutes later, it was level. Moss received ample reward for his industry, when he angled a neat header into the corner of the net fyet another cross by Nicholson.
It was nonetheless, a colourful afternoon for the big striker and with just minutes remaining he handled the ball in the penalty area, gifting United a penalty and earning a red card.
The task was duly met by Miller, and he answered the expectant home fans by slotting the ball home for the hard fought victory - and not before time for the patient Tannadice regulars.