Miroslav Klose's struggling Nuremberg picked up a much-needed win after edging a thrilling game in Düsseldorf.