The Foxes, third in the Premier League, toiled for much of the match against a Blues side whose dogged defensive fortitude saw them arrive at the King Power Stadium unbeaten in 13 matches in all competitions.
The tie looked to be heading for extra time but right-back Pereira was on hand to head home the decisive goal with 82 minutes on the clock.
It was Leicester's first goal in 387 minutes of football, since a 2-2 draw with Chelsea on February 1.
The hosts enjoyed a lot of the ball but their possession-based game often lacked intensity and urgency, particularly in the first half, against a well organised Birmingham defensive unit.
The Foxes' best chances during the first period both came down the left-hand side. Ben Chilwell's cross-cum-shot was deflected just wide of the far post early on while James Maddison made space for himself, cutting one way then the other, before his curling effort was palmed away by Lee Camp as half-time approached.
Birmingham posed a threat on the break. Kerim Mrbati led an excellent counter attack midway through the first half, intercepting Wilfred Ndidi's pass before knocking the ball through the Nigerian's legs and advancing up the pitch. A neat one-two with Scott Hogan allowed Mrbati to strike at goal but his shot was deflected wide.
Leicester needed to improve if they were to find a breakthrough and Brendan Rodgers's side began the second half with purpose. Jonny Evans headed over from a corner before a heavy touch inside the penalty area denied Dennis Praet a clear shooting opportunity, with the ball ricocheting to Kelechi Iheanacho, but his effort was easily smothered by Camp.
Maddison went close twice in quick succession as the midway point of the second half approached. First the midfielder curled a free-kick into the side netting, before seeing a 25-yard strike clip the top of the crossbar shortly afterwards.
The hosts were knocking at the door and thought they had scored after 74 minutes when Iheanacho raced through and rounded Camp before finishing into an empty net. However, VAR correctly ruled that he was offside.
Leicester did not have to wait much longer for the breakthrough. A driving run by left-back Chilwell saw his delivery go all the way across the box to Marc Albrighton on the opposite side, and his cross was headed home by Pereira.
The Premier League side survived a late scare when the ball dropped in their penalty area and Harlee Dean's goalbound effort struck Chilwell, but Leicester held on to progress.