Run Fatboy Run
(2008)

Dennis (Simon Pegg) abandons his pregnant bride Libby (Thandie Newton) on their wedding day due to a panic attack.

5 years later, Dennis is a slob, and finds out Libby has a new boyfriend Whit (Hank Azaria) and tries to win her back by vowing to complete the marathon Whit has entered.

Dennis is tripped by Whit on race day and damages his ankle but completes the race. Whit was caught on national news tripping Dennis. Libby leaves Whit and takes her son to the finish line with to be with Dennis.

Dennis is a hero as the last finisher because of his struggle and is shown in the following days to be a changed man, being more of a father and eventually asking Libby out on a date again.
 

Thanks Dan!