Guns being used in crime (generally robberies) preceded the advent of modern "street crimes" (i.e., getting mugged walking home from work) as we think of them, because guns preceded the heavy urbanization that was a prerequisite for most such crime being commonplace.
Guns
Handguns first came into existence, probably, around the mid-late 15th Century, in the form of "hand cannons," and by the 17th century, a variety of somewhat easy-to-use pistols were available. A major revolution in pistol technology came with the advent of the flintlock, right at the turn of the 17th century. Flintlocks (along with better techniques for manufacturing black powder, shot, and gun barrels) allowed for smaller, more reliable, pistols to be produced in large numbers. These proliferated around much of Europe very quickly, through a variety of means.
Robbery
However, as I said, urbanization was not high at this time, and one of the most important ways people (especially merchants) made money was by traveling from town to town, delivering goods. This was all before railroad, needless to say, so for getting to more inland towns, the main option was coach, cart, or horseback. High-ranking people often traveled, as they do today, between town and country, also inland. And of course, there was the mail, often delivered by postboys on horseback. All of these traveled along thoroughfares called "highways," and these highways became a place for mounted bandits known as "highwaymen" (sometimes called "road agents" in America, or "bushrangers" in Australia) to waylay and rob people.
Highwaymen were, along with pirates, probably history's first really well-known criminal types. They were to be distinguished from another class of robber known as a "footpad," as highwaymen were mounted and were considered a higher "class" of criminal. You will sometimes hear thieves referred to with disdain as "common footpads," and this is the origin of that derision.
Some highwaymen became a sort of celebrity, much like famous pirates. This was also history's first really common and well known employment of guns (at least handguns) in common crime. Highwaymen famously brandished their "pistols and rapiers" when they waylaid a coachman, shouting their equally famous: "Stand and deliver!" command, ordering the coachman to stop and deliver his goods.
Guns and Highwaymen
But famous or not, there's no doubt that guns were widely employed by highwaymen. The most famous highwayman of all is undoubtedly Dick Turpin, who is well known for having robbed many a man with the Essex Gang, his group of bandits, using pistols. We know from court proceedings, for example, that he and his men waylaid a man named Sheldon outside Croydon, and relieved him of his possessions; all were armed with pistols. Later, the same gang made a brutal raid at Loughton, as recounded in Read's Daily Journal from 1735:
On Saturday night last, about seven o'clock, five rogues entered the house of the Widow Shelley at Loughton in Essex, having pistols &c. and threatened to murder the old lady, if she would not tell them where her money lay, which she obstinately refusing for some time, they threatened to lay her across the fire, if she did not instantly tell them, which she would not do. But her son being in the room, and threatened to be murdered, cried out, he would tell them, if they would not murder his mother, and did, whereupon they went upstairs, and took near £100, a silver tankard, and other plate, and all manner of household goods. They afterwards went into the cellar and drank several bottles of ale and wine, and broiled some meat, ate the relicts of a fillet of veal &c. While they were doing this, two of their gang went to Mr Turkles, a farmer's, who rents one end of the widow's house, and robbed him of above £20 and then they all went off, taking two of the farmer's horses, to carry off their luggage, the horses were found on Sunday the following morning in Old Street, and stayed about three hours in the house.
This was by no means an uncommon version of events. So, we can see that highwaymen moved from robbing along the roads to assaulting houses, burglary, lying in wait, etc., all with ever-present pistols, easily by the early 18th century. Things were changing bit by bit as the 18th Century gave way to the urbanization of the late 19th, and as railroads replaced highways, thus ending highwaymen and their phenomenon, but giving way to more urban crime.
It is also worth noting that as highwaymen became more prevalent and aggressive in the 17th, 18th, and 19th centuries, merchants and travelers took steps to defend themselves, as well. More than a few highwaymen were killed when they ripped open the door of a carriage only to find the lady inside was herself armed with a pistol and ready to use it. "Riding shotgun" became a famous trope from the American West, as stage coach riders took security personnel, also armed, with them. As guns proliferated among criminals, so too did they among their putative victims.
"Street Crime"
It must be clear, then, that by the time urban street crime had come about, guns were already in widespread use by criminals. This was likely the case throughout much of the world, but the largest centers of urbanization at this time were in Europe, so it's not impossible to believe that they were widespread in Europe and America, as well.
Sources:
Sharpe, James (2005), The Myth of the English Highwayman, London: Profile Books
Seal, Graham (1996), The outlaw legend: a cultural tradition in Britain, America and Australia