Forshaw converted a penalty in the 93rd minute following an Adam Dugdale handball, moments after substitute Cole Stockton had pulled Rovers back level for the second time.
Chris Atkinson and Dugdale had responded to early efforts from Martin Taylor and Clayton Donaldson, before the latter netted again in the 71st minute to put the Bees 3-2 up.
Taylor gave Brentford a third-minute lead when he stabbed in the rebound from Harlee Dean’s goal-bound volley before Donaldson reacted to a loose ball to make it 2-0 with less than quarter of an hour gone.
Tranmere searched for a way back into the game and it came a minute before the interval, with Atkinson slotting home after an intricate passing move undid the Bees defence.
Brentford keeper Richard Lee then couldn’t keep out Dugdale’s 55th-minute equaliser after getting a hand to Joe Thompson’s header but Donaldson soon pounced to head home his second.
Stockton thought he had played a super-sub role to perfection for Rovers when he found the net on 90 minutes but an injury-time penalty allowed Forshaw to net the winner.