Why is this? All the votes are not just shuffled together and counted. Instead we have a number of electoral districts (29, apparently - shows how much I paid attention in high school) each with a set number of seats to distribute. And a given party may be much closer to another seat in one district than in another. So depending on the district the votes were cast, the same number of votes may give different results.
Also, the counting method (a variation on the Sainte-Laguë method) tends to help large parties a bit at the expense of small ones1. For that reason and for the reasons above the final seat allocation may become somewhat different from what the total voting percentages would suggest.
So some of the seats are not allocated directly, but put in reserve and used to even out this discrepancy in the final count on Wednesday2. This time - with lots of small parties and two large, evenly matched parties - the reserved seats were not enough, and the coalition actually has about two seats less than they would have gotten had there been enough reserve seats to go around.
This means that a very small shift in total votes may trigger a rearrangement of final seats and have quite a large effect; enough that the coalition gains those final seats and a majority. Will they? We'll know on Wednesday or Thursday.
[Edit: the method is Sainte-Laguë, not D'Hondt. They're very similar, though]
#1 Why is Sweden (and other countries) using vote allocation systems that sometimes give wonky results? It's because there is no system that will always give what we would consider a fair allocation. The criteria we have for fair allocation can't all be fulfilled at the same time, so no matter what system you choose you end up with the possibility of a more or less unfair allocation.
#2 Apparently the final count and allocation is always on the Wednesday following the election, and the numbers we hear on election night are all preliminary estimates. Few people ever cared, though, until this year when it suddenly matters.