Petunia Dursley was no angel. In fact, she was really quite terrible. She was at best negligent of a helpless child and, at worst, cruel to him. Harry Potter committed no crime save being related to Aunt Petunia's sister, and Lily committed no crime (that we know of), save being a witch. Whereas Vernon and Dudley's treatment of Harry can be attributed to their bigotry, ignorance, and fear of what they don't understand, Petunia's most definitely runs deeper. She was left behind by a sister she loved and isolated from a life and world she could never be a part of. And then, from her perspective, the people who took Lily away were also responsible for her death.
So her feelings toward Harry Potter were understandably conflicted — although this by no means justifies her terrible treatment of an orphan boy who needed a mother figure. But a moment in Goblet of Fire sheds light on a side of Petunia we hadn't really seen up until that point from the overindulging mother of a very, very spoiled child. In a moment of perceived danger, her maternal instincts kick in and her selfishness flies out the window faster than a speeding Bludger. A recent Reddit thread described the situation perfectly:
In the beginning of the book, there is a chapter where Mr. Weasley, the twins, and Ron arrive by floo powder at the Dursley's house to collect Harry. It's a funny chapter that really underscores the differences between wizards and the Dursleys, especially with Arthur vs. Vernon, but I was struck by the Dursley's bravery.
At first, Vernon shields Petunia and Dudley with his body while talking to the Weasleys, which is brave in and of itself, given how he feels about wizards. However, the scene that made me have to turn off the book and think for a minute happened after Ron and the twins had left. The twins had left behind the ton-tongue toffee, which Dudley had eaten, which forced his tongue to grow. Arthur steps towards him with a raised wand, saying he can fix it — as readers, we know he would never hurt Dudley, but the Dursleys don't have that insight.
Petunia and Vernon loathe wizards and are terrified of them. In this scene, this complete stranger, this wizard, has blasted apart their fireplace without a second thought, demonstrating a great deal of potentially destructive power. He steps forward toward Dudley, wand raised. Petunia immediately throws herself across Dudley, shielding him from what she perceives to be malicious intent, exactly like Lily shielded Harry from Voldemort.
It was a small detail, a single line in the book, but it blew me away. She may not be a likeable character, and is of course awful towards Harry, but in this moment she was remarkably selfless and brave in the perceived face of death or serious harm.
Does Petunia deserve a little more sympathy and understanding? Nothing excuses the way she treated Harry, but from her perspective, she's seen the bad side of magic more frequently than the good — which explains why she so adamantly wants to stamp it out of her nephew.
And don't forget the most important point of of all: when Petunia received the Howler from Dumbledore in Half-Blood Prince, she (for once) defied Vernon and absolutely insisted Harry be allowed to stay at Four Privet Drive. She knew doing so might very well be saving his life, the same way allowing him to come back each Summer protected it. She never wanted Harry dead; she simply did not want the daily reminder of a dead sister and her own guilt over their unresolved relationship.
Then, in her final goodbye to Harry, although she can't bring herself to show any love toward him, she does the only thing she can do:
"Aunt Petunia, whose face had been buried in her handkerchief, looked around at the sound. She did not seem to have expected to find herself alone with Harry. Hastily stowing her wet handkerchief into her pocket, she said, 'Well — good-bye,' and marched toward the door without looking at him.
'Good-bye,' said Harry.
She stopped and looked back. For a moment Harry had the strangest feeling that she wanted to say something to him. She gave him an odd, tremulous look and seemed to teeter on the edge of speech, but then, with a little jerk of her head, she bustled out of the room after her husband and son."
She is not a character with some heart of gold buried beneath her facade, and she isn't even someone I'd say is redeemable (like Severus Snape, for instance). She has no love for Harry. She's someone with a difficult past, who was put in a hard situation and who responded to that in the wrong way. Sadly, she never really allowed herself the chance to make it right. One has to hope that her son, Dudley, with his final handshake and moving goodbye to Harry, one day decided to have the courage that the other Dursleys didn't — to become a better person than he was raised to be.