Fanfic is a very grey area of writing, some writers don't mind you doing it; to them it's a kind of compliment. While others totally forbid it, their characters are theirs.
My view as an outsider is that to use an idea is fine. "Did we see him?" was loosely based on a mix of H.G. Wells and Jules Verne.
The ill-fated on line serial I ran "The Word," was loosely based between Farenheit 451 by the late Ray Bradbury and Mad Max.
In my view, to use an idea but give your twist is the honour to the original writer, not mindlessly copying their style.
My view is that if you have to use my characters in my settings, then all you are doing is copying my work. To me, writing involves a degree of interaction with your characters, not just churning out somebody else's thoughts because you have none of your own; much akin to the mass of tripe called the Zombie genre.