Lewis Hamilton said he was thankful to hold on for victory at the British Grand Prix after suffering a puncture on his final lap.