Ernie Macmillan is one of those side characters who I think gets written off a little too easily. Yeah, he's pompous and a bit of a know-it-all, especially in the early books when he's loudly proclaiming Harry's guilt in 'Chamber of Secrets'. But that's precisely his influence – he's a barometer for the wider Hogwarts student body's opinion, especially among the 'respectable' pure-blood families who aren't Death Eaters. Harry's journey isn't just about fighting Voldemort; it's also about navigating social prejudice and winning over a skeptical public.
Ernie embodies that challenge. His initial suspicion, then his full-throated support for Harry in 'Order of the Phoenix' when he organizes the D.A., shows a character capable of growth and loyalty once presented with real evidence. He's not a Seamus, who doubts from a place of personal confusion, but from a place of societal expectation. Overcoming the Ernies of the world is a quiet, crucial victory for Harry's legitimacy.
In the final battle, seeing Ernie there fighting, a Hufflepuff prefect who could've easily kept his head down, matters. It signifies that the fight has truly become everyone's, that the protagonist's cause has moved beyond his immediate circle. His influence is subtle, a thread in the larger tapestry of how a hero builds a coalition.