One of my favourite books is The Talented Mr Ripley by Patricia Highsmith. Tom Ripley, the main character, displays a lot of characteristics we're supposed not to like: he lies all the time, he's ingratiating, he takes money under false pretenses. And yet we like him. We like him so much that we're on his side when he murders first Dickie Greenleaf and then Freddie Miles.
We've all been in situations where we feel out of our depth and vulnerable. Tom Ripley feels like that for much of the book and he tries to deal with it. He wants to be Dickie's friend, and most of us have experienced wanting to be friends with the coolest kid in the class, the feelings when the friendship is reciprocated, then the horrible sensation when you realise that the friendship has waned and you're suddenly out in the cold. Okay, so most of us don't respond by bashing the coolest kid's brains in, but I reckon we all know the feeling of wanting to. We understand why Tom does it.
What's brilliant about Highsmith's writing is that, because we only see Dickie from Tom's point of view, we accept his assessment of the situation. If you looked at it from Dickie's point of view...this bloke turns up, tags along, is unfriendly to your girlfriend, is a bit weird and intense, you catch him in your bedroom dressed up in your clothes, he gets possessive about you, wants to go with you everywhere - well, it's understandable that you'd withdraw a little. Freddie deserves to die even less. Freddie is loyal to Dickie, tries to help him, begins to work out what Tom has done. But in Tom's point of view he's unattractive, fat, red-haired and is threatening Tom's safety. We accept he deserves to be whacked with an ashtray.
That's the book. The film tips the scales even further in Tom's direction. Tom's talented and clever but poor. Wealthy Dickie is unpleasant to Tom, taunts him and in a fit of unhappiness, Tom kills him (rather than the murder being premeditated, as in the book). Freddie steals Dickie away from Tom, excluding Tom for snobbish reasons. They are both careless of Tom's feelings. They deserve what they get.
So, your character doesn't have to be nice or even someone you'd like to spend much time with so long as we not only understand where they're coming from emotionally but have been there too. Tap into those deep emotions most of us have felt and we'll forgive your main character anything, even murder.