It was the Bees' first defeat in 10 games and came just hours after manager Uwe Rosler had departed to Wigan.
James Berrett's first-half goal for Carlisle was cancelled out by Pascal Chimbonda's own goal after half-time, but two Lee Miller strikes, one a penalty, helped put the Cumbrians into the third-round draw before Farid El Alagui kept Bees' hopes alive with his late header.
Bees goalkeeper Richard Lee twice had to show alertness in the first half, producing a fine instinctive save from Sean O'Hanlon's header from Berrett's corner, then diving across to his right-hand post to palm away Tom Lawrence's 30-yard free-kick.
Berrett got forward into the Brentford box and it took a timely intervention by Jake Bidwell to block his first-time effort, but there was no denying the midfielder in added time just before the break when he made the most of a shooting chance to lash a stunning drive into the top right-hand corner.
But Carlisle were caught out by Alan McCormack's hard, low cross from the right, which led to Chimbonda diverting the ball into the net from six yards out to give Bees their 63rd-minute equaliser
Carlisle restored their lead in the 73rd minute when Miller received the ball from Berrett and found the bottom corner with his low shot from 12 yards.
Miller made it 3-1 in the 77th minute from the penalty spot after McCormack had fouled David Amoo, making no mistake as he blasted home low to Lee's right.
Carlisle had some nervous moments after El Alagui had headed home in the 86th minute from Sam Saunders' set piece, but held on.