Adam Hložek struck twice as Hoffenheim ended a two-game losing streak with a hard-earned win at home to local rivals VfB Stuttgart.