Place it just before the near-miss in the edit, then follow it with a shocked sound for the reaction and a goofy yell as the person recovers, keeping the warning first so the joke builds in the right order.