Answer: You did not mention which Bible teacher taught this belief concerning children and heaven, or which version of Scripture he was using. Nevertheless, the scriptures you gave indicates biblical illiteracy, and possibly his desire to terrify unwed parents. There are only three instances where the word "bastard," used in Scripture to denote children born out of wedlock, is used.
No one born out of wedlock (children whose parents are not married) . . . may be included among the Lord's people (Deuteronomy 23:2)
A mixed race (children born out of wedlock) shall settle in Ashdod . . . (Zechariah 9:6)
If you are not punished (or corrected, like a parents toward their offspring) . . . it means you are not real children, but bastards (Hebrews 12:8)
In the Old Testament, children were considered a bastard if their mother was a non-Israelite (heathen) regardless of whether their father was an Israelite or not. Easton's Bible Dictionary defines the Biblical term "bastard" as being synonymous with the word "polluted." In Deuteronomy 23 the term is used to simply mean offspring that are illegitimate.
In Zechariah 9:6 the term bastard for a child is used as another reference for a foreigner. Finally, Paul's use of the word in Hebrews 8 was meant to convey the idea of a group of people who don't share in the same privileges as those who are converted.
Even though the Lord told the children of Israel not to marry into the pagan nations that surrounded them they did so anyway. He called the offspring of such unapproved marriages bastards. It took several generations before the descendants of such marriages were allowed back into the Lord's congregation (which is another name for the nation of Israel).
In your question sent to BibleStudy.org you also referenced the book of Judges in regard to a leader born out of wedlock. What happened in Judges 11 was not God's doing. Gilead fathered Jephthah by a harlot, as well as sons by his wife. When the "legitimate" children grew up they chased Jephthah out of town because he was "the son of a strange woman" (verse 2). If you read the rest of the story you'll find their fortunes changed, and they called Jephthah back home to be their leader.
Our Creator in heaven is, without a doubt, no respecter of persons. The apostle Peter, a Jew, was speaking to a group of gentiles when he said that God does not respect one person over another but rather accepts anyone who is willing to listen to Him and do his will (Acts 10:34 - 35).
Gentile children, of course, have no choice as to who their parents are and neither does an illegitimate (born without the benefit of their parents being married) person. The apostle Peter, however, reminds us that if anyone, regardless of how they came into the world, fears God and does what is right, that they will be accepted.
The nature of a person's birth has nothing whatsoever to do with whether or not they are ultimately saved. Children born out of wedlock does not matter, what really makes a difference is whether a person has a close and intimate relationship with our Father in heaven.