I never thought of ostriches as particularly dangerous — until I read the unexpectedly gripping Wikihow article on "How to Survive an Encounter with an Ostrich".
Now I'm terrified! Basically, ostriches are velociraptors — capable of running 43 miles an hour, and possessed of "razor sharp talons" on legs powerful enough to deliver a 500-psi blow. They've also got a sharp beak on a neck with a lot range, and they stand seven to nine feet tall. They're pretty dumb, thankfully. But if you get into conflict with one they're nasty streetfighters.
So, how to keep from having your ass handed to you by a Struthio camelus? The article's worth reading in full — not least for the awesome illustrations (the artist was clearly having fun with this one) — but basically you run for cover, hide, climb a tree, or as a last ditch prepare for combat.
Use a long weapon. If you are forced to defend yourself against an ostrich, avoid close-quarters combat. Keep as far out of reach of its legs as you can. Use the nearest, longest object that could be used as a weapon, such as a pole, rake, broom, or branch.
If you have a gun and need to use it, aim for the ostrich's main body to better ensure hitting your target. Although they will be attacking with their legs and/or beak, their legs and neck are very thin and easy to miss.
Keep to the ostrich's side. Consider yourself at the most risk when the two of you are face-to-face. Remember that an ostrich is only able to kick its legs directly in front of it. Stay behind or to the side of the bird as much as possible to keep clear of its most powerful weapon.
Aim for the neck. Consider this to be the ostrich's weakest body part. Strike it where it is most vulnerable and least protected to defeat it more quickly. Failing that, aim for its breast. Concentrate your efforts between the two as opportunity affords. Continue to strike until it quits and runs away.