Arsene Wenger continued his extraordinary 21-year unbeaten record in the FA Cup at the third round stage.
Olivier Giroud - who else? - scored in the dying minutes of the game to sink a plucky Preston, who took the lead through Callum Robinson after just seven minutes.
The Championship side failed to convert a string of gilt-edged chances when they were on top in the first half, with the misses coming back to haunt them at the final whistle.
After the break Wales midfielder Ramsey scored straight away for his first goal of the season and it started a period of dominance for the North London side which culminated in the late winner.
The Gunners' awful display in the first half, of course, had the #Wengerout brigade vocal as ever.
There was also good news in the shape of the returning Danny Welbeck playing his first game from a long-term injury.
Giroud said after the game: "They put a lot of intensity in the duels ...we wanted to show something else in the second half, but we need to start better the game.
Ramsey said: "They took us by surprise, we didn't match their intensity and effort ... I am happy that one has finally gone in. It gave us momentum to get the result.
"We keep going to the end and have scored a lot of late goals. We have that belief."
And, there was some uplifting news as fans remembered Mustafi remained unbeaten in every game he has played with Arsenal.