I’ve seen this done in many stories, and kill me, I can’t come up with an example for you, it simply escapes my mind (maybe it’ll come to me later and I’ll edit this post), but the idea is simple.
If you’ve tried everything you possibly could to fix a story issue (a plot hole, a character flaw, a scene dead-end, a continuity lapse, a deus ex machina element, etc.) and it’s not getting fixed, PLAY IT UP. Feature it. Make it glaringly obvious.
Say, you have a character, Joe, discover a gun in a place where there logically can’t be a gun, and to the reader it’s simply too convenient that Joe, while being ambushed by a dozen warriors, looks under a bush and finds a gun (deus ex machina!!!).
So, instead of planting a solution in the previous chapter (make Joe's buddy Chuck put a gun there, which will force you to go further back and come up with a reason why Chuck put the gun there, and it’d just destroy your plot with all the changes you’ll have to make), simply have Joe say, “Well, I'll be damned. A gun. How the hell did it get here? Fall from the sky?” Then pick it up and use it.
The reader will chuckle, forgive you for this lapse, and keep reading.
Which is what you want.