This GitHub library I wrote will do that - you enter the Twilio details in a Custom Setting, expose a public Apex Rest Service via Force.com Sites, and tell Twilio to post to that URL. SF will receive the Twilio post about the SMS, look for an existing contact/case, and if it doesn't find one, create a case...
Just to add more explanation to the worflow, you expose the smstoApex class as a public REST api via Force.com Sites - which provides the URL you use in Twilio.
That class in turn passes the details of the SMS to this processing class which parses the SMS from the Rest Request params (From Number, To Number, Message Body). It then searches for a contact based on From Number, and then cases for that Contact to determine if it is a message for an existing case, or if it requires a new case to be created. It then writes all the details to an SMS_Message_Tracking__c custom object, and sends the Id via email to this processing class. Why the email? Because the Sites user can't write to Chatter - and we use Chatter on cases to 'Thread' the messages for a case. So we send it to that class via an email service so it is processed by the a user with Chatter read/write privileges so we can use Chatter to alert call agents/display message thread.
If you don't want to use Chatter, you can just have the Sites user do all the processing...it can create/edit cases.
This repo actually uses Email to Salesforce to enable Chatter to work on the Cases, but you can modify the inbound handler class to just create a case directly if that is easier