"I'm returning power to your hands, and I'm going to make my resignation to the state council," Cerar said in a statement, quoted on his official Facebook page.
"I took this decision because it is necessary to know what is right and what is wrong. It is about the responsibility I accept and for a decision that any trustworthy politician would take," he added.
The voting on a railway between Divaca and Koper, worth 1 billion euros ($1.2 billion), was annulled earlier on Wednesday.
This hurdle in the way of the government-led infrastructure overhaul added to the pressure piled on the cabinet by teacher unions ahead of a parliamentary election in June. The prime minister’s resignation could push it forward by several weeks.