Fetching details from the dictionary...
to ultimately fail despite being in a favourable position; to fail at the last moment; to win the battle but lose the war; to have the upper hand in sumo (technique) but lose the match