Xatu first activate your ability. Then stir up a heat wave for fun. Then jump across a ledge to get to a safe location from the wild Pokemon. Please and thank you.
Heracross activate your ability jump over the ledge and if you will be hit by the heat wave use Protect to block it.
Credit to Sworn Metalhead