Khale da Costa scored his third goal in four matches since joining the club, continuing his good start in a Harlow shirt, before two quick-fire goals early in the second half put the hosts ahead.
Stanley Muguo equalised for the visitors, sending the game to penalties, where the Hawks held their nerve to score four against Brentwood's two.
Harlow Town boss Danny Chapman rang the changes in defence with Jared Small moving to right back to replace the suspended Craig Pope, and Billy Jones returning from injury at left-back.
The Hawks dominated large portions of the first half, but it wasn't until the 37th minute when Khale da Costa swept home a cross at the back post to finish a move that put the visitors ahead.
Brentwood goalkeeper Joe Taylor made a number of fine saves to keep his side in the game, which paid dividends when pressure from the home team saw them take the lead in the second half.
Andy Greenslade scored soon after the re-start, drawing level in the 49th minute and then scoring a second seven minutes later when he bundled a rebound over the line.
Stanley Muguo equalised in the 68th minute, and when Arthur Goncalves saw red after 77 minutes it seemed like Harlow were more likely to be the winners.
The Hawks were unable to find a third goal, and despite Brentwood seeing a second red card when Sam Owusu was sent off in injury time, the score was level after 90 minutes and the tie was decided by a penalty shoot-out.
Harlow were clinical from the penalty spot scoring all four of their spot kicks, and when David Hughes made a good one-handed save it meant Brentwood couldn't afford to miss any more. Their final penalty flew over the crossbar, giving the Hawks the win.
FT: Brentwood Town 2-2 Harlow Town (Harlow win 4-2 on penalties)
ATTENDANCE: 76
Harlow now progress to the 4th Round where they will play Tilbury from Ryman League Division One North.