I've had many, many flubs. Some I could weasel my way out of but some were just dwad in the water. I try to remember that, if you take it well and show a little humility (and humour), the audience is still entertained. The rule is to make sure you always have a killer ending in reserve.
A couple of years ago I was doing the bar at the magic castle. I had my usual set but I also had a few items on reserve, should the mood take me. Luckily for me, Bob Sheets was there every night with some fantastic advice about loosening my grip and letting things seem more random.
In the spirit of that advice I found myself giving an audience member too much rope to hang me with and a very complex two deck effect went bye-bye.
I made a few gags - blamed it ALL on the guy who shuffled (for fun), put away the cards and it played like an elaborate gag. I then used the same guy for the next trick and got back on track without the audience feeling that I had lost control.
The fact is I just learned to run with mistakes and make them fun for the audience. Just remember to end with a strong, reliable trick so that any mistakes are over-ridden by strong magic.