The Indian overcame a poor start as he was dominated in the first set but eventually won 0-6, 7-6 (6), 4-1 when his German rival, world number 125, retired due to fatigue.
Somdev, known for playing long matches with a never-say-die spirit, kept Berrer in the match with his amazing retrieving ability.
Somdev, who is leading a players' revolt against the national federation, next plays fourth seed and world number 29 Austrian Jurgen Melzer in the euro 410,200 event.
It will be first meeting between the two players.
Photograph: Matthew Stockman/Getty Images
Somdev in 2nd round of Zagreb ATP event
Federer blown away by Melzer in Monte Carlo
In Pictures: 30 Years Of Michael Jackson's Thriller
PIX: Drama unfolds as Somdev goes down fighting at Oz Open
Down memory lane: The best and worst of Schumacher