It appears to be purely a gag. It seems to only appear over the heads of love-struck characters, who will follow you around. I have 100% and all trophies, so if they do something else, you obviously don't need to worry about it for 100% anyway. --- John Lennon, 1940 - (Infinite Symbol)
In freeplay, characters with question marks above their head means a Dark Wizard needs to use the Imperio curse on them (the dark equivalent of Harry's Focus spell).
As for the ghosts, they tell you how much of everything you have in the area. So if they have a 1/2 Gold Bricks above their head, it means that there is still one gold brick left in the area. Same with the character tokens, students in peril, red bricks etc. --- John Lennon, 1940 - (Infinite Symbol)