The Lilywhites trailed until 13 minutes from time when substitute Ched Evans headed them level from a Ben Whiteman corner.
Then in the 82nd minute, Emil Riis made it a dozen goals for the season with the winner.
Paddy McNair had given Boro a 33rd minute lead, with Daniel Iversen making six good saves to keep the scoreline at 1-0.
PNE head coach McAvoy said: "I thought we started the game really well, we were brave to start with, taking the ball from the back.
"There were a couple of good shouts for penalty kicks in the first half, the first a stonewaller and the second one I thought might be given as well.
"We conceded from a corner kick again which was disappointing despite the fact we had worked hard defending them - it is like a bus, we didn't concede for a long while and then two have come along at once.
"I always felt that if we could get a goal we could go on and win the game.
"At half-time I told the lads we had been 1-0 down before, we would do what we did against Coventry a few weeks ago, we will burst it open and go man for man.
"We might at times have been vulnerable defensively but we had to be brave.
"At times we got a bit of fortune, they had one which hit the cross bar and bounces down.
"I have said for a long time that Ched is a big player for us, he has been since I came in.
"It's just great that I could manage to get him on the bench tonight and get him on the pitch.
"You could see the impact he made for us. The subs did well coming on which we hadn't done lately if I'm honest.
"His goal was magnificent, it was a fantastic header from a great delivery from Ben Whiteman.
"For the second we got a bit of fortune with their player making a mistake, his decision making and passing it to Emil - it was a magnificent finish from Emil as well, he chopped inside and uses his left foot.
"A pleasing thing for me was that it was the first time I had gone to a back four, played a 4-3-3, and ended up winning the game."
McAvoy was pleased to be able to send the 400 or so travelling PNE fans back to Lancashire with something to cheer about.
The Scot said: "That is four wins in the last seven games.
"The biggest thing is the team spirit, I felt they showed that. I know it's always been there. It is good and strong.
"I felt the supporters were magnificent, they turned up in fantastic numbers, we heard them all the way through - similar to Bournemouth."
Thanks for reading. If you value what we do and are able to support us, a digital subscription is just £1 month for the first two months. Try us today by clicking here