This should give you a good starting point;
scirra.com/forum/how-do-i-make-earth-rotate-around-the-sun_topic45633.html
Then every time the object makes a full orbit, or x amount of time has passed, slowly decrease the distance until it collides with the object.
I think you'd need to use delta timing to decrease the orbit, but if you store that rate in a variable, you'd also be able to increase the rate the object gets sucked in the closer it gets to the object it's orbiting. Which would make for a much better gravity effect.
You could create a circle "gravity field" object and turn off its visibility, and use that to detect when an object has fallen into the object's gravity well. I think you'd need to pin the gravity field to the object you want to have gravity, and then resize it based on the mass of the object.
Once your object collides with the gravity field, that's where you'd start the orbit away from the centre of your larger object, so you'll need to calculate the distance between the small object, and the centre of the larger object, and make that the point that the object starts orbiting.
Hope that gives you some general direction.