Children have a tendency to bond closely first with their opposite sex-parent, and only afterwards with their same-sex parent. Disruptions in this course of childhood development tend to have pervasive effects on the personality of the person in question.
Sokka In Sokka's case, his mother Kya died while he was still a young child, which seems to have had at least some effect on how he views himself on a deeper level, if one takes his character development in "The Runaway" at face value. In part, this would be due to how Katara took his mother's place early on in his life; a key feature of sibling rivalry is the fear that one's sibling is closer to one's parent than oneself (which at a gut level is thought to be because they are innately better than oneself), and the fact that Katara was able to take on the role of the mother of the family so readily after Kya died - to the point of displacing her in his mind - would likely stoke this unease in Sokka's mind. This would also have a hand in his continual self-assertion of his own masculinity; having had the mother-son bound broken early in life would tenderize the strength of his attachment to his same sex parent and thus his gender role-model, hence his overriding need to prove himself in that area - which would also explain why he placed a higher emphasis on seeing his dad again then Katara did. He told next to no one about this, and with good reason; when the subject of the death of their mother did come up in "The Southern Raiders", Katara directly implied that Sokka didn't love their mother in the same way she did (and this despite having overheard Sokka's secret conversation), which judging by his reaction inflicted pyschological pain upon him. (Since he also feels the need to prove himself to his dad, Hakoda also is unconsciously disregarded as a confidante, whether fairly or not.) Bearing this secret seems to have made him cynical to a degree, and is probably in a large part responsible for the sarcastic attitude he takes toward life.
Toph Toph, obviously, has not had the type of tragedy in her family that Sokka had; indeed, her parents are the only two who are still both alive and obviously together of all the main character's. Neverthless, this does not mean all is well at home, the blindness of their daughter apparently being a sore spot for her parents, as it would seem to disqualify her as a practical manager of their entire estate when she eventually inherited it (which is what they would have been expecting out of their child), in a way that not even her being born a female would. Hence, Lao became over-protective of her and treated her as if she was a delicate object that needed to be constantly watched over lest it break, barring any real warmth of relationship between himself and his daughter. Poppy, as apparently submissive as she was, hardly helped such matters, mainly acting as a buttress to the enforcement of the authortarian way Lao had their daughter watched over. Because of the tenderness of her father-daughter bond with Lao and the corresponding general weakness of her relationship with Poppy, Toph was hardly motivated to learn female gender roles from her mother, preferring instead to throw off the assumption of her unworthiness by proving her equality with sighted people via Earthbending in the most blatantly tomboyish way possible - which in the end amounts to an attempt to prove her worth to her father, the dominant force behind her feelings of unworthiness via his authoritarian, over-protective eye. When all this came to naught after her Earthbending prowess was revealed to her father, she then ran away from home, the pyschological strain upon her having brought her to the breaking point for an individual of her age. Similar to Sokka, her pessimistic attitude on life largely stems from her inability to overcome the main pyschological issue of her childhood, as does the sarcastic attitude she takes towards most subjects.
Why The Two Bonded as Closely as They Did From the very outset, Sokka would have been empathetic towards Toph, having been given a sense of her general backstory as she expressed her dilemna to her parents towards the end of "The Blind Bandit", and understanding the similarities of their problems on some gut level. This empathetic sense of similarity between the two of them is likely why Sokka stepped out in defense during "The Chase" when Katara and Aang were treating her like she was a jerk (a label easily placed upon himself as well), understanding to some degree the reasons why she was acting the way she was and thus knowing that their rejection of her could easily give Toph more problems than she already had. Given Sokka's emphasis on his own masculinity, he has always been protective of the opposite sex in general, and in the case of Toph he most likely acts the way he does in an attempt to protect her from what he himself has to deal with.
This had the side-effect of stimulating a crush on Toph's part, though one she is mostly in denial about and tries to ignore. Aside from this, due to both to Katara and Aang's intentional pairing-up with one another (leaving them together by default in the group's early days) and to their pyschological similarities, the two bonded closely as friends. This brings us to the point of "The Runaway", where Sokka shows his closeness to Toph (to the viewers, at least) by telling her how Katara had replaced Kya in his mind. This is a turning point in a proper understanding of the characters, simply because it reveals that Sokka's apparent protectiveness of his younger friend is borne out of a simple desire to protect girls in general; if Sokka truly wished to protect the opposite sex from the harshness of life, it is profoundly odd that he would reveal this bit of information about his own problems to Toph. Why would he do this, and what does he expect to get in return? He reveals this part of his life after explaining how he relies on Katara's motherliness to Toph, which probably means that he felt the need to confide his fears surrounding that subject to a girl who would understand his problems. In return for this, he probably expected on an unconscious level - and he recieved - a caring (maternal) response from a person who had similar problems, and who could sympathsize with him in the midst of his problems - as Toph eventually did, by admitting how Katara also filled a spot in her life that her own mother failed to. All this might seem out-of-place for the characters in question, unless one sees this as a marking point in the inter-relationships of the two characters which reveals the high importance each holds in the other's life, and the needs that each finds fulfilled in the other person.
Toph can hardly be blamed for thinking that their friendship might go somewhere, as Sokka's apparent pyschological expectations of her actually point in that direction; people tend to end up with those who are similar-yet-complementary in personality to themselves, and also with those regarded as the pyschological replacements for the place their parents once held for them (or those places they sought for their parents to fill) early on in life - which is exactly what Sokka seemed to have been expecting, even if he doesn't associate that with romantic relationships at that point in his life.
Agree or disagree, please express your views of this discussion (that my brother "Toph's Fanboy" and I had together before I posted this) in the commenting section below.