What is meant by "the first will be the last and the last will be the first"? What is meant by "the first will be the last and the last will be the first"?  

In Matthew 19:30 it tells us about the rich young man who asked Jesus on what good things he must do to receive eternal life.  Later Peter said, (19:27) "we have left everything and follow you. What will we have?. Jesus said to them " you can be sure that when the son of man sits on his glorious throne in the new age, then you 12 followers of mine also sit on thrones, to rule the twelve tribes of Israel. And everyone who has left houses or brothers or sisters or mother or fathers or children or fields for my sake will receive a hundred times more and will be given eternal life. But many who now are first will be the last, and many who now are last will be the first." 

Is there any connection between Matthew 20:16 about the workers in the vineyard and in Mark 9:35?
If you look at the context in the parable, in Matthew 20, I believe you will see that Jesus is addressing the issue of spiritual pride.  Those who worked all day thought that they deserved more pay, even though they had agreed to their wages before their work began.  They were comparing themselves to those who came last and were paid what they themselves had agreed to work all day for.
Jesus had the latecomers in the parable being paid first to set up the tension of the situation and evoke feelings about what seemed unfair to the listeners.  It seemed unfair on two counts, that those who worked all day had to wait until last for their wages, and that they didn't receive more than those who only worked after being hired &quot;at the eleventh hour.&quot;
The all-day workers prided themselves on their long hours, but forgot their agreement with the boss.  They grumbled.  Their hearts weren't to serve the boss well to please him, but only for what they could get out of it.
The latecomers were grateful for the job and the pay to which they had agreed.  They probably felt a bit sheepish receiving their wages under the scrutiny of the onlooking all-day workers.  They may have felt unworthy to be counted among them, but gladly received their wages from the boss with hearts full of thanks.  They didn't expect anything more than what they had agreed to.
In heaven, there will be people who recognized God's grace in Jesus Christ at an early age and received eternal life.  They will have walked with Him for a lifetime.  There will also be those who only recognize His grace for salvation at the end of their lives.  They, too will enter heaven, but with less works with which to glorify Christ.  His grace to them is no less.  They came last, but are &quot;first&quot; in the sense that all who receive His grace are first.  They don't demand anything, yet He freely bestows eternal life and blessing.
Those who think they deserve salvation should be wary.  If they are working for reward, they may receive it in this life, but the life hereafter will hold nothing for them, because they have rejected what was offered--the free gift of salvation.  They come to the front of the line, expecting a grand entrance, but Jesus says, &quot;Then I will tell them plainly, 'I never knew you. Away from me, you evildoers!'&quot; (Matthew 7:23)
Now that someone has edited the question, to include Matthew 9:35, I include the fuller quote here (verses 31-37):

for he was teaching his disciples, saying to them, “The Son of Man is going to be delivered into the hands of men, and they will kill him. And when he is killed, after three days he will rise.” But they did not understand the saying, and were afraid to ask him.
Who Is the Greatest?
And they came to Capernaum. And when he was in the house he asked them, “What were you discussing on the way?” But they kept silent, for on the way they had argued with one another about who was the greatest. And he sat down and called the twelve. And he said to them, “If anyone would be first, he must be last of all and servant of all.” And he took a child and put him in the midst of them, and taking him in his arms, he said to them, “Whoever receives one such child in my name receives me, and whoever receives me, receives not me but him who sent me.”

From this broader, Biblical context of Jesus' words and teaching, it does seem that He is indeed addressing spiritual pride and pride in general.