The Premier League champions have not lost a game since Ranieri, 65, was dismissed in February.
They also reached the Champions League quarter-finals after overturning a first-leg deficit against Sevilla.
"No one can say it was the wrong decision, the three results have been brilliant," Bilic said.
"Still for me it was a bad decision, Claudio did very decently with them. But it's the nature of the job, you are the first one to pay the price."
Ranieri led Leicester to a surprise Premier League title in 2016 but the Foxes were one point outside relegation zone and had lost their last five league matches before he was sacked.
Leicester had not scored a league goal in 2017 but have since scored seven in three matches under Craig Shakespeare, who has been put in charge of the first team until the end of the season.
"I said after they changed manager what I thought about it and still I don't understand it," Bilic said.
"But if you talk about results and performances, they got what they wanted."
West Ham, who are 11th in the league, play the Foxes on Saturday at 15:00 GMT at London Stadium.
Leicester City's sacking of Claudio Ranieri was a "bad" decision but it has been vindicated by their results, says West Ham manager Slaven Bilic.