If Gastly with the "Swelling Spite" Ability is my last Pokemon in play and is Knocked Out, do I get to search for 2 Haunter and put them on my Bench or do I lose the game?
Yes, you get to use the Ability before you lose. Gastly is Knocked Out, the opponent takes a Prize card, and then you search your deck for 2 Haunter and put them onto your Bench. (Then you would have to promote one of the Haunter as your new Active Pokemon.)
Source: Unbroken Bonds FAQ (2019-04-19), TPCi Rules Team (2019-05-02)

Relevant cards

Note: All applicable cards may not be listed below.
SM10_67
SM10_67