Saroha managed a distance of 9.01 in his fourth attempt after squandering the first three attempts.
He again fouled the fifth before ending with 8.7m in his sixth and final attempt.
Latvia's overwhelming favourite Aigars Apinis clinched the gold with his best throw of 20.83 ahead of Poland's Robert Jachimowicz (19.10) and Croatia's Velimir Sandor (18.24).