If your elaborate magic trick goes awry, and instead of pulling a rabbit out of an audience member's shoe, you set the shoe on fire, you might give a rueful smile. Rueful means apologetic or remorseful.
The adjective rueful sincerely expresses regret, but it manages to do it with a hint of humor. Rueful shows up a lot in descriptions of remorseful grins or apologetic smiles. If you're sorry about something you've done but you can still laugh at yourself a little bit, you feel rueful. The word itself comes from the verb to rue, which means "to regret."