pip somebody at/to the post
pip (someone) to the post
To defeat or succeed over someone by a very narrow margin or at the final, crucial moment, especially in a race, competition, or athletic event. Primarily heard in UK, Australia, Ireland. The favoured runner held the lead for the majority of the race, but a relatively unknown competitor pipped him to the post in the final 100 metres. It appears the young candidate is set to pip his competitor to the post for his seat in parliament, which would make him the youngest candidate from this constituency to do so in nearly 60 years.