Matt Doherty's stoppage-time header earned a dramatic win against the 10-man Magpies at St James' Park