Leeds threw away a three-goal lead as they were held to a 3-3 draw against Cardiff at Elland Road.
They looked to be cruising when Bamford converted a penalty that he had won seven minutes into the second half.
Sean Morrison pulled another back with eight minutes to go before he was red carded for violent conduct four minutes later.
But the 10 men shrugged off the setback and pulled level through Robert Glatzel with two minutes to go.
Leeds started strongly from kick off with Pablo Hernandez shooting wide inside the first minute.
They got their reward when Costa fired in off the post after Hernandez's long ball picked him out following a sixth minute counter-attack.
It got even better for the home side two minutes later when Bamford doubled their lead after getting on the end of a Stuart Dallas cross.
The Welsh side survived penalty shouts after 24 minutes when Joe Bennett appeared to bring down Costa.
Bamford blazed a dangerous free-kick well over after 28 minutes before Nathaniel Mendez-Laing curled wide two minutes later.
Danny Ward and Joe Ralls failed to hit the target as Cardiff enjoyed a better spell.
Hernandez could only shoot straight at the keeper after 40 minutes after he latched on to a defensive mix-up.
Luke Ayling fired over seconds after the restart as Leeds showed no sign of letting up.
And it 3-0 after 52 minutes when Bamford slotted home from the spot after he had been fouled by Neil Etheridge.
It was nearly 4-0 two minutes later when Etheridge did well to keep put Mateusz Klich's header.
Tomlin pulled a goal back on the hour mark when he lifted the ball into an empty net after Casilla messed up a cross.
Klich saw a shot deflected wide for a 71st minute corner before Hernandez fired just wide after a bursting run.
Morrison headed home after 82 minutes from Bennett's cross as Cardiff set up a tense finish.
But he was the villain minutes later when he was sent off for a lunge on Eddie Nketiah.
Cardiff then dramatically levelled after 88 minutes when Glatzel slotted home after Pascal Struijk failed to clear his lines.