Another note:
Those who knew Jesus was Lord used His name and did the wonders.
But Jesus never knew them.
But they knew Him!
Paul made an interesting note about this in the same chapter about the gifts.
1 Cor 12:3 Wherefore I give you to understand, that no man speaking by the Spirit of God calleth Jesus accursed: and
that no man can say that Jesus is the Lord, but by the Holy Ghost.
You cannot know Jesus is Lord but by the Spirit.
This reminds me of Peter knowing who Jesus is, and so much so that Jesus declared the Father revealed it to him in Matt 16. He genuinely had an experience with God to know who Jesus is. However, like Matt 7 where Jesus said he did not know the Lord-Lord criers and that they were not hearing HIS WORD and obeying it, when Jesus spoke to Peter about the cross, Peter resisted. And that's when Jesus called him satan.
What are workers of iniquity whom Jesus does not know? Those who do not carry their crosses.
So, the reason why you can say LORD LORD and know who Jesus is, like Peter, and yet perform wonder in his name that you know is the name of the LORD and Him not know YOU and be lost, is because we must go further than knowing HIS IDENTITY and LORDSHIP and listen TO HIS WORDS (from the SON) about the cross, and OBEY IT!!
This means you can hear from the FATHER about the Son's Identity, but not hear the second revelation from the SON about the cross.
Jesus said to Peter "AND I SAY ALSO UNTO THEE." And proceeded to speak of the cross.
So, Jesus said HEAR MY WORDS and obey them...