RCB had lost two consecutive matches to give themselves plenty of work to do in their quest for a top-four finish, but they claimed only a third win of the tournament at M. Chinnaswamy Stadium on Tuesday.
Manan Vohra top scored with 45 on a dry pitch, but the Royal Challengers lost their way, Brendon McCullum (37) and captain Virat Kohli (32) failing to go on after getting starts, posting 167-7.
Pandya took 3-28 and made 50 off only 42 balls, but the RCB bowlers were much improved and raised their game in the field to claim an important victory.
Defeat for defending champions Mumbai leaves them facing a major battle to reach the semi-finals.
VOHRA TAKES DUMINY APART, UNLUCKY 13 FOR PANDYA
Vohra made his presence felt in only his third appearance of the tournament, smashing four sixes at the top of the order.
JP Duminy suffered at the hands of the opener, who hit two sixes and two fours in four balls during a fourth over which went for 22.
Pandya made a nightmare start, conceding seven runs off one ball when McCullum (37 from 25) hit a delivery above waist height over the ropes before taking full advantage of the free hit with a ramp for six to take 13 off one legal ball.
PANDYA MAKES AMENDS BEFORE GRAND GOES BIG
Pandya was in no mood to feel sorry for himself, running former New Zealand captain McCullum out with a superb direct hit to leave RCB 121-3 in the 15th over.
The India star also saw the back of Mandeep Singh and Washington Sundar as the Royal Challengers lost five wickets for 22 runs in the space of four overs.
Colin de Grandhomme flexed his muscles in the final over with what proved to be a key contribution, emulating McCullum by hitting a full toss from fellow Black Cap Mitchell McClenaghan for six off off what would have been the last ball and doing the same again with the free hit.
De Grandhomme had already smashed the fourth delivery off the final over - which cost 24 - for a maximum to finish unbeaten on 23 off 10.
RCB BOWLERS ON THE MONEY
The RCB bowlers have come in for some flak, but delivered under pressure on this occasion.
Mumbai slumped to 84-5 when Umesh Yadav produced a great piece of fielding to send Duminy on his way and also finished with figures of 2-29.
Tim Southee (2-25) and Mohammed Siraj (2-28) also made an impact, the former dismissing Pandya in the final over to all but end the contest.