Agnes is all over finding Gerda's weak spot, which is to say, the thing it will hurt her most to give up. She's going to get revenge for those sandals. File this under Missing the Point.
She pretends to be Gerda's BFF, of course, because she's a 7th grade girl. This entails swapping hair bands and confessing to a nonexistent crush on Huge Hans.
Gerda totally falls for it and invites Agnes over to her house, where Agnes figures out what it will kill her to give up: her hamster, Oscarlittle.
So, of course, that's what Agnes demands.
Gerda cries, and Agnes almost feels sorry for her, but then she thinks of her sandals out there in the sawmill and that's that. Because sandals are alive and have feelings and are totally the same as a hamster.
When Gerda puts Oscarlittle on top of the heap, Otto and Huge Hans praise Agnes for finally making the heap of meaning really meaningful.