There are several ways to win at the very last second.
But first keep this in mind.
It is not the last bid that wins it is the highest.
Your opponent won because he bid more than you.
If your last bid had been higher, his bid may have been in vain. Or not.
He could have used 'set automatic bid'
He could have been very fast with his bidding finger and internet provider.
Or he could have set a snipe bid with a service like esnipedotcom, which will make bids in the last seconds of an auction. This is a paid service, so your opponent actually spent even more for the item than you can see, and more than you were willing to pay.
Winning bids are not made by nibbling.
Bid once, bid your maximum. Be sure of the shipping cost when setting your maximum.
And in many cases, bid late.
But once again, you cannot win if the other guy bids more than you do.