A George Moncur goal eight minutes from time sent North End into the Play-Offs and saved Colchester United from relegation.
The midfield man guided the ball into the bottom left hand corner after the U’s had earlier missed a penalty.
Chris Porter fired over from the spot after Sam Johnstone was adjudged to have felled the man who later scored the goal that saved the U’s from the drop.
It was an unchanged 18 for North End, with the yellows going with the same side that beat 3-0 against Swindon Town the previous week.
The first half was a cagey affair, the first chance coming eight minutes in when Joe Garner headed goalwards from 12 yards out from Daniel Johnson’s cross from the left, but it was straight at Sam Walker.
The home side’s first shot came on 25 minutes as a Richard Brindley shot took a deflection and Sam Johnstone saved well low to his left to push the ball around the post for a corner.
Ten minutes before the break a Chris Humphrey effort was tipped away by Walker in the U’s goal after Jermaine Beckford had broken down the right hand side and freed the No.7.
The best chance of the opening period came right on half-time, however, as on loan winger Jacob Murphy lobbed Sam Johnstone from the left flank, but the ball flashed across the goal and out for a goal kick, much to the relief of the yellow clad away following.
The second half started with much more pace about it with both sides knowing that one goal could give them the points they needed.
But it was the home side who won a penalty 12 minutes into the half when Sam Johnstone was adjudged to have brought down George Moncur.
Chris Porter stepped up, but fired the ball high and over the bar.
North End then saw a Gallagher free kick clocked by the wall before a trio of corners followed, the away fans now highly vocal.
It was kitchen sink time as North End pressed forward in massive numbers as the game entered the final 25 minutes.
Sam Johnstone was needed with 19 minutes left to deny Murphy after a break by Massey down the left and then he claimed the corner bringing a level of cvlam that no one else in the stadium was feeling.
Joe Garner hit the stanchion behind the goal with a header from Daniel Johnson’s cross as the last ten minutes drew close.
Garner then fired goalwards from 30 yards only for Walker at full stretch to palm the ball wide.
But with eight minutes to go George Moncur fired home from 12 yards out to break the deadlock.
With North End throwing men forward the home side almost grabbed a second on the counter only for Johnstone to save with his feet.
North End threw more bodies forward to try and get back into the game, but they could not break down a resolute Colchester back line and now face Chesterfield over two legs in the Play-Offs.
Colchester United line-up: Walker, Khumalo, Gilbey (Szmodics, 80), Briggs, Eastman, Massey, Moncur, Murphy (Sembie-Ferris, 80), Brindley, Fox (c), Porter. Subs not used: Lewington, Wynter, Healey, Bonne, Lapslie.
PNE line-up: Johnstone, Clarke (c), Laird (K Davies, 86), Welsh, Wright, Huntington, Humphrey (Robinson, 58), Johnson, Garner, Beckford, Gallagher. Subs not used: Stuckmann, Wiseman, Kilkenny, Woods, Ebanks-Blake.
Attendance: 8,413 (2,969 away fans)
: Mr K StroudReferee