Monaco could have overtaken leaders Paris Saint-Germain with a win at the Stade Louis II on Friday, but instead suffered their first home loss of the season.
Eric Abidal's own goal and David Ducourtioux's strike put the visitors in the driving seat before the returning Radamel Falcao missed a penalty, only for James Rodriguez to reduce the deficit from the subsequent corner.
Rodriguez was then denied a late leveller by an offside flag and Ranieri, who admitted the linesman got that call right, could only lament an opportunity missed.
"I know football and I always say that every game is difficult to my players," the head coach said.
"I think that we did not play well in the first 15 minutes. Then we played much better and got a lot of chances. We wanted to play too quickly and we've been kind of unlucky.
"I will tell to you as I said to my players, football is like that. It is a wonderful game. Valenciennes played well, without stress, and with nothing to lose.
"We conceded the first goal, the second one was a good counter-attack."
On the offside call, he added: "I think that it was for three centimetres only. The linesman I think has a bionic eye, because he can see the offside, and I confirm it was an offside."
Falcao, who has been out with a thigh injury, came off the bench at half-time for his first appearance since November 24 and Ranieri was content with his display.
"After one month without training it is not easy to play, so he played well in regards to what he could," the Italian added.
"If we had converted not half, but a quarter of all the chances we had during the game, we would have won 4-2."
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.