"Then all the virgins arose and trimmed their lamps" - Let it be observed that the prepared (i.e., the wise) and the unprepared (i.e., the fools) arose at the same time. There was no period of time separating them, as some believe. The resurrection at Jesus' second coming will be a universal one (cf. John 5:28,29; Acts 24:15).
The difference in the two groups of virgins is easily seen in Matthew 25:8 - "Give us some of your oil, for our lamps are going out." The foolish virgins make their request, but the answer is "no." On Judgment Day, no one will be able to share their faith (i.e., their "oil") with others, no matter how badly they may desire to do so. Each will be judged according to the record of his own life (cf. II Cor. 5:10). One cannot transfer his "righteousness" to another (cf. Eze. 18:20). It is certainly the case that we are to share with those in need, but some things cannot be shared (e.g., reputation, character, dedication, obedience, faithfulness, etc.).
It is also certain that one cannot buy an active, obedient faith for himself. Thus, the fact that going to buy oil is mentioned in Matthews 25:10 should be simply understood as part of the imagery of the parable, a detail that has no symbolic importance.
The coming of the bridegroom represents the second coming of Christ, and only those who had properly prepared went in to the wedding feast. Then, "the door was shut." These are ominous words; they suggest finality. Practically speaking, the door is shut when one no longer has the ability or opportunity to properly prepare himself to meet God in judgment (e.g., death, coma, serious brain damage, etc.; cf. II Cor. 6:2). Once the doors were shut for a wedding feast, they would not be opened. To be shut out from such was to be deprived of joy and participation therein.
"Afterward the other virgins came also, saying, 'Lord, Lord, open to us!'" - Although they may plead passionately, the anguish of the lost will not sway the divine justice of God at the time of judgment (cf. Matt. 7:21-23). "I do not know you" - The foolish virgins had not cared enough about the wedding to make the proper preparation, and thus, the groom refuses to recognize them as his acquaintances. Adequate advance preparation must be made before the Lord returns (or before our death). To adequately prepare after our resurrection is impossible, for there will be no time for such (though some may try).
It should be pointed out that the terminology Jesus uses in 7:23 is similar, but there is an important difference. There He says - "I never knew you" - in reference to alien sinners. However, the statement He makes here is to Christians whose faith has not remained living and active. A child of God can (and will) fall from grace if he allows his faith to die. Even if one appears to be faithful (as the foolish virgins did by not abandoning their post), such does not imply that one is right with God. One can lose eternal life without being an obvious apostate. It is not enough to merely be in the kingdom; one must stay prepared. If we are found in an unprepared state on the Day of Judgment, the Lord will not count us as one of His acquaintances, much less as part of His household.
The main thrust of this parable is that one must be prepared for the return of the Lord (cf. 24:42). The emphasis of Jesus' next parable is that one must be faithful as a servant of God.