Tipperary survived a late Derry revival as Conor Sweeney's injury-time point gave them a 1-21 to 2-17 win and put them through to the All-Ireland football quarter-finals.