"Have" is the helping verb and the main verb. It's in the Past Perfect tense, so it's "had had." The adverb "just" is placed between the helping verb and the main verb, so we end up with "had just had."
"Just had" would be the Simple Past tense, but the Past Perfect tense gives us more specific time information. It tells us that the conversation had happened before the moment she had the thought.