The scores were level at 1-1 after extra-time at Griffin Park after Gary Alexander had equalised for the League One side after Seamus Coleman's first Everton goal had given David Moyes' side the lead.
Lee saved Jermaine Beckford's spot-kick with the scores at 3-3 before Charlie MacDonald, who had earlier missed a penalty in normal time, scored to put the pressure on Phil Jagielka, who fired his shot at the post to send the home fans into ecstasy.
It was a deserved win for Brentford, while Everton's miserable start to the season continues.
Phil Neville, who had been absent since the opening day with a foot injury, gave Everton a boost by returning to a line-up that also included a first start for Yakubu.
Tim Cahill, who had been struggling with a knee injury, did not make the bench while youngsters Coleman and Magaye Gueye were given a chance to impress.
Andy Scott made only one change from Saturday's draw against Huddersfield, with Richard Lee replacing Ben Hamer in goal.
It took Everton just six minutes to break the deadlock when Yakubu found Diniyar Bilyaletdinov and the Russian laid the ball to the unmarked Coleman to smash past Lee.
Everton turned up the pressure, going close with a Jagielka header before Lee raced out to scramble the ball away from Yakubu, who had been played through by the impressive Gueye from the right flank.
Brentford started to get back into the game around the half hour mark.
MacDonald's header sailed just over the bar before the home side claimed they should have had a penalty when Bilyaletdinov clumsily ran into the back of Weston inside the box but referee Michael Oliver failed to point to the spot.
Marouane Fellaini glanced an acute flick against the post from a Gueye cross with eight minutes of the half left before Lee saved well from a 25-yard Yakubu strike.
The home crowd then erupted as Brentford equalised when Weston broke down the right to cross for Alexander, who powered a header past Jan Mucha.
Coleman then turned villain by giving away a penalty when he pulled the back of Weston's shirt inside the box.
But Mucha, who was only making his second Toffees appearance, spared Coleman's blushes by saving to his right from MacDonald's spot-kick.
Moyes looked to Mikael Arteta and Stephen Pienaar for inspiration as they came on with 20 minutes left.
Lee came to Brentford's rescue once more when he saved low down from Gueye inside the box.
Brentford still looked dangerous though and Toumani Diagouraga came within inches of putting Scott's side ahead seven minutes from time with a volleyed lob that drifted just over the bar.
Pim Balkestein then saved the Bees with a last-ditch tackle to deny Everton as the crowd were being treated to a pulsating end-to-end finish.
Coleman then burst past two Brentford defenders before drawing a terrific reaction save from Lee in the dying minutes of normal time.
Osman had the first chance of extra time when he wriggled his way past two defenders before blazing a shot over from 20 yards.
Jagielka's header was cleared off the line in a desperate scramble in added time at the end of the first period as Brentford looked content to hang on for penalties.
Everton resumed their onslaught after the break, with Arteta forcing Lee into a spectacular one-handed diving save.
Osman then broke into the box before sending his strike over Lee's goal.
The home supporters urged their side on as they kept possession well to frustrate the Toffees and take the game to penalties.
Leighton Baines powered the first spot-kick home before Weston beat Mucha to his left. Neville then put Everton 2-1 up but Nicky Forster's well-placed finish levelled things at 2-2.
Spillane then matched Arteta's strike to take it to 3-3 before Lee dove to his left to save from Beckford.
MacDonald's goal then meant Jagielka hit had to score to keep Everton in the tie but his shot hit the post and the home fans spilled onto the pitch in jubilant celebration.