Birsa struck in the 56th minute, and Pecnik doubled the lead in injury time to eliminate Northern Ireland from the play-off reckoning and put Slovenia in pole position - two points ahead of the Czech Republic, with bottom-of-the-table San Marino still to play in their final match on Wednesday.
Slovakia, meanwhile, are no longer such strong favourites to progress automatically and will almost certainly need to beat Poland in their final match to stay ahead of Slovenia.
A goalless first half began with a Birsa effort from just inside the penalty area, which was well-saved by home goalkeeper Jan Mucha in just the second minute.
Jan Durica responded for Slovakia seven minutes later with a shot from the edge of the area which beat goalkeeper Samir Handanovic but clipped the bar on its way to safety.
Slovenia pressed again and gave Mucha plenty to think about, Andraz Kirm among those keeping the home goalkeeper busy.
Long-range efforts by Marek Hamsik and Robert Vittek did not unduly trouble Handanovic - and the last chance of the first half fell to the visitors' Zlatko Dedic, whose header from a corner flashed wide.
Slovenia began the second half well, and a Birsa header was only just off target in the 54th minute.
The same player made no mistake shortly afterwards, though, giving Slovenia a deserved lead with a well-placed shot from the edge of the area.
Birsa threatened again just after the hour but put his shot over.
There was minimal response from the hosts, and Mucha needed to be alert again to keep out strikes from Aleksander Radosavljevic and Dedic.
Slovenia missed another good chance when Kirm failed to beat Mucha from close range three minutes from time.
But as Slovakia frantically sought an equaliser, Pecnik cashed in on the counter-attack to finish precisely from 15 yards.