QUEST_COMPLETE fires not when you complete the quest, rather when you're about to complete it anyway.
The following QUEST_LOG_UPDATE event is when the quest will actually be gone from your log.
So all you have to do is temporarily store all quests at QUEST_COMPLETE, then diff them with all quests in your log at QUEST_LOG_UPDATE and you're good.
For figuring out which quests to turn in at an NPC, you'll have to check
QuestFrameCompleteQuestButton:IsEnabled()